Sep 26

PHP Sql server to Client with No Refreshing

Although nearly our companies work is template based design, the outcome is always unique and adapts to each client’s individual needs. The method of merging a client’s content and style with these templates creates ways to challenge ourselves and once more put our web design skills to the test. Recently, I discovered myself in a scenario where it had been essential to pass information

In the proper execution of GET data from a straightforward flash button to a server side scripting language- all without reloading the existing page. A consumer was  really running different flash banners ads via XML layer, underlining a number of her hottest products online. She  really needed a simple way to track the entire efficiency of her small ad campaign. Specifically, she needed to learn which sorts of banners were clicked on and those banners were just annoying or unimportant to her client base. She also needed to understand which were the most used browsers accessing these pages. I’ll try to explain what needed to take place devoid of getting too techie.

An PHP Sql server layer popup would pop-up, offering the conclusion user with a two options. In option A, you can have the popup. This could bring them to wherever the popup was made to take them. Option B was for the conclusion user to close the popup, and that will simply hide the layer’s visibility property. At first, it sounded easy. However, beyond the most obvious functionality of options A and B, each option had a need certainly to open, write, and save to an additional file all without refreshing the existing page. All things considered, the past thing anyone wants to see after closing a popup is another page pop up.

Nevertheless server side scripting languages, like PHP Sql server, demand a refresh of the page to pass information. Unlike JavaScript which handles its business on the client side of a customer server system via your browser (the client), PHP scripts are server-side since they operate solely on the server; data is sent to via POST or GET The script is then parsed, and the newest data is repaid to the browser if necessary.

Sep 23

Reasons to go with php sql server driver Development

Php sql server driver has changed into a globally popular scripting language within the last few years. It’s been specifically made for producing web pages. Developers can effortlessly implement solutions for complex web difficulties with PHP. It allows the programmers to create dynamic pages quickly and easily. It’s a proposed language for developing forums, calendars, mailing lists,  shopping carts communities,, project management tools, and a variety of functional web applications. All you’ve got to is a professional PHP web developer. Listed below are the utmost effective 10 reasons to opt for PHP application development:

User friendly: Its very user friendly PHP. It is a straightforward language that doesn’t follow strict rules like other scripting languages, e.g. C# and Java. If you’re a new comer to the entire world of Php sql server driver, you can very quickly become knowledgeable about mostly all its elements. Simplicity with this language is the utmost effective reason that’s driving lots of visitors to go in the field of PHP software development.

A well documented scripting language: In relation to focusing on a script level language, you may want plenty of documentations, e.g. tutorial, references, scripts,  examples,  readymade etc. PHP could be the wealthiest to contain a large number of full manuals online and lots of them are available to everyone in need. Just Google your PHP development issues and you could see some developers who’ve already fixed those issues for you.

Great community support: PHP can be supported with a huge community all over the world. The language has been receiving great affection from the start. You will undoubtedly be amazed to observe dedicatedly people try to obtain just more using this language. Actually, it’s town of PHP developers that have got a strong language.

Sep 19

Php sql server connection for Quality Web Applications at Affordable Rates

Once you see a lively website, first thing that involves the mind is Php sql server connection. It is practically the lifeline of lively websites in which repeated sending and receiving of information to and from the record is necessary. In case of other platforms, those sites often become weighty consuming plenty of time for refreshing and loading , but PHP mitigates the possibility of such issues enabling websites to execute smoothly. PHP application development is becoming so popular that currently you will find 20 million or maybe more domains utilizing Php sql server connection. These generally include Face book Wikipedia and other well recognized sites. Here we shall discuss what triggers the popularity of PHP and how developers could make optimal utilization of PHP applications.

Advantages of PHP

Open Source: Because this programming language is open source, PHP application development becomes highly cost-effective. Backing by means of a large population of PHP developers can be available and there’s continuous strengthening of the platform in the form of updates and responses to queries by other developers.

Convenient Integration: It’s possible to merge an alternative party application across a PHP-oriented website in a hassle-free manner. PHP offers seamless integration for several open source CMS (Content Management System) such as for instance, Ecommerce, WordPress, Joomla, Drupal and more.

Cross Browser or Cross Platform Compatibility: Php sql server connection paves room for convenient database creation. Support is provided for various databases such as for instance MS Access, MySQL, Sybase, Oracle, Posters an d SQL server. PHP is one of many greatest alternatives for cross platform applications, as it lends support to key os’s like Mac OS X , Linux as well as Microsoft Windows.

Sep 13

Microsoft driver for php sql server

Microsoft driver for php sql server provides easy optimization of your website for search engines. A powerful website leveraging PHP development has become the best selection for getting high internet search engine rankings.  There are many platforms for web application development that can come with their very own limitations while suiting to client’s needs. PHP applications score in this respect as they could be easily manipulated to meet up client requirements.

Once utilized with efficiency, Microsoft driver for php sql server application development becomes the top selection for enterprise solutions, social networking sites, shopping carts, CRM and so on.

PHP is an open source platform; therefore considered most by app developers. It runs on multiple platforms like Windows IIS and Linux Apache. On one other hand, ASP isn’t suitable for other platforms. Recently, merely a fewer new versions of ASP had the opportunity to perform on different platforms. So, it’s all set for PHP, if you’re searching for compatibility.

Hovering over these points, it’s seen that PHP is a perfect selection for effective web development. Price, developer’s community, program compatibility, and speed are essential for an effective project, and Microsoft driver for php sql server provides each of these features/advantages. Consider these benefits and offer a start.

PHP may also act as a visual application. A lot of the web servers utilize Microsoft driver for php sql server website development as a processor. On most of the os’s, PHP web services works as a separate interpreter. Though Microsoft driver for php sql server is flexible and developers are imperative for effective website development. For php web development, you could hire a PHP developer or perhaps a PHP web development company to have effective services.

May 24

Error Control in PHP

Error handling strategy is used to capture the occurrence of a situation that prevents a successful system operation. This can take place at different levels. Low level: a function can receive an unexpected parameter. At a high level, a tool can not accept certain sequence of user actions.

I think it is crucial to distinguish what is a low-level error of an error high level. Each of these errors can take a different course and be reported to the user differently too. If, for some reason, the programmer created a SQL wrong and this prevented a value to be saved in the database, it is not convenient to tell the user that the problem was in SQL, after all, the end user need not (and should not) know what is SQL. However, if the user has filled in a form field with an invalid value, it must be informed in detail about what he missed and/or how to fix.

Using exceptions natives(exception)  language PHP is a solution particularly suitable for dealing with low-level errors. In the case of high-level errors, can also be used the same alternative, although I prefer to use methods of input validation of user data and store the error messages in an array (for example). Note that usually in these cases there is no attempt to adjust the invalid value entered by the user, so is the responsibility of the user to correct the problem itself. Already low-level error, you can try to be bypassed in some way (or not).

The operation of exceptions can be relatively simple, but also lets you build solutions rather sophisticated. Don’t intend to discuss the use of exceptions. So, if you want to dig, read the manual:http://www.php.net/manual/en/class.exception.php. If you don’t like to create exception to this and that, maybe it’s a good to know the exceptions defined by SPL: http://www.php.net/manual/en/spl.exceptions.php.

A reasonable solution to error control is to create methods that return Boolean values ​​(true = worked / false = went wrong) and, optionally, the method takes an array of errors that should be passed by reference. Then, if a problem occurs, the array of errors is completed and it will return false.

For errors that should never occur (for example, an error use of a resource by a programmer), it is possible to use exceptions, but can also be used to launch the error log. This is done by the function trigger_error. The function receives a message and an error level. Levels that may be issued by the programmer are:

  • E_USER_NOTICE - When you want to send a notification to the programmer (not necessarily an error). For example: a function consumed more memory than expected.
  • E_USER_WARNING - When you want to issue a warning to the programmer (a mistake, but not too severe). For example: failing to connect to the database (for some unknown reason), but the page still can be generated with a warning to the end user.
  • E_USER_ERROR - When the error is fatal and must stop running the script (the programmer can not launch the system if an error is being caused these). For example, a method needed to receive a mandatory data type, but received another.
  • E_USER_DEPRECATED - A special type of warning to indicate that a method is depreciated (should no longer be used and/or has been replaced by a different way to perform the same operation).

There are two functions in PHP especially useful to standardize the flow of processing errors and log unhandled exceptions with try/catch. They are: set_error_handler and set_exception_handler. This makes it possible, for example, store some types of errors in a database to facilitate searches, track the amount in a given period etc..

Apr 22

URL Manipulation

Introduction

In web development,  is very common to use links. It is also common that the links need to be manipulated to add or remove parameters. In this post, we will see how to manipulate a link and its parameters so easy and safe.

Breaking a URL in parts

When a programmer doesn’t know the capabilities of PHP to handle URLs, it is common venture to manipulate the string with the URL directly, making operations such as checking if there is ‘?’ in the URL and get the content to the left or right, etc..

The main function to “parse” a URL and break it into parts is parse_url. This function can be used for two purposes: to get all the parts of a URL or to obtain a specific part of a URL (for example, the protocol, the domain, the query string, etc.). For all parts, just pass the URL as a parameter and don’t enter the second parameter:

For a specific part, just pass the second parameter of the function, which specifies which part is desirable. This parameter can have one of the constants:

PHP_URL_SCHEME
PHP_URL_HOST
PHP_URL_PORT
PHP_URL_USER
PHP_URL_PASS
PHP_URL_PATH
PHP_URL_QUERY
PHP_URL_FRAGMENT

Note: If you want the file name, just apply the function on the basename of $parts['path'], as an example:

Breaking the query string into parts

As you can see, the function parse_url returns the query string of the URL in the way it is and not divided into parts. To break the query string into parts, just use the function parse_str passing the query string as the first parameter and the second parameter as a vector. Vector will be populated with the variables present in the query string, so that the array index stores the variable name and each position points to the respective variable value (the value is automatically decoded urldecode). Here’s an example:


Modifying the URL or Query String

After breaking the URL and optionally the query string, just manipulate the vector $parts or $queryArray as desired. For example, let’s change the protocol from http to https, change the port from 80 to 81 and remove the parameter “x” and include the parameter “z” value “abc”:

Riding the URL with the parties

After manipulating the URL and/or query string, we now need to assemble the parts and form the URL as a string. To do this, simply use the function http_build_query to mount the query array to turn it into query string. This function now makes coding using urlencode, then you need not worry about reserved characters.

Unfortunately, http_build_url function is only available via PECL. However, it is a very simple function to implement. See below:

Now just use this function and run:

 

Apr 03

PHP Settings

PHP is an interpreted language that allows multiple policies are configured, both the core of the language and its extensions.

Each policy has a “mode shift” that defines where and when it can be modified. For example, some can only be set in the settings file managed by the server administrator, for security reasons, while others can be changed by the programmer in the application itself.

The modes change the policies are:

PHP_INI_USER - can be changed with ini_set, file .user.ini or in the Windows registry.
PHP_INI_PERDIR - Can be modified in php.ini.htaccesshttpd.conf or .user.ini.
PHP_INI_SYSTEM - Can be modified in php.ini or httpd.conf.
PHP_INI_ALL - can be modified anywhere.

Note: some policies belonged to a mode change by a certain version of PHP, but switched to another mode in another version of PHP. This information is displayed in the list of language policy.

 

1.0 Configuration files (php.ini)

 

phpini

 

The default settings are defined in the PHP files “ini” which have syntax based on simple key/value. They are loaded so that a script starts running, but the values ​​can be cached and re-loaded periodically for performance.

The file name may vary according to sapi used. For example, the default file is php.ini, but if you run the CLI sapi (PHP commands in terminal) is the sought php-cli.ini file and if it is not found, it uses the default file .

These files are in a directory server settings (on Linux are usually in the directory “/etc/”, although this site may be modified during the compilation of PHP or some alternative, although not common). Usually only the server administrator has access to these files for changes, for security reasons. This is especially useful for hosting servers, where scripts from one domain can not interfere in another.

 

2.0 Settings by Programmer

 

There are basically 3 ways programmer override the settings of PHP: through ini_set (at runtime), the .htaccess (if using Apache) or file .user.ini (an alternative created in PHP 5.3). Note that in these cases, the behavior is modified specifically for a script or set of scripts and not all PHP files, as with the php.ini file.

2.1 Using ini_set

Using ini_set, simply specify two parameters: the first is the policy name and the second is the value you want to apply to it (as a string). To get the current value of the policy, there is a function ini_get (simply enter the name of the policy). For the value of all policies, or any policies of an extension, there is a function ini_get_all. And to return the policy value to its initial value (when started the script), just use the function ini_restore stating which policy should be restored. example:

 

2.2 Using .htaccess

Use the file .htaccess for Apache servers is allowed in PHP is being used as a module. Apache must be properly configured to accept this type of file in the application directory. In this case, a policy can be defined using two syntaxes. A non-Boolean values ​​to set and another to set boolean values ​​(which may take “on” or “off”) as examples:

Note: in httpd.conf policies can be modified with php_admin_value and php_admin_flag. This can be useful to apply different settings for different directories (or different virtual hosts).

 

2.3 Using .user.ini

Use the file .user.ini is an alternative to the .htaccess, and was incorporated to PHP in version 5.3. For now, it can only be used by SAPIs CGI or Fast CGI. The syntax used in these files is identical to that used in php.ini.

The file name used for this type of configuration ( “.user.ini“) can be modified in php.ini through policy user_ini.filename. This is typically required when the application is already using that name for another purpose.

Note: it is recommended to hide access to this file, as well as (usually) is done with .htaccess to prevent it can be read by any user accessing the system.

 

3.0 Settings useful to know

  • display_errors and display_startup_errors - Indicates whether errors should be displayed or omitted (normally “on” in the development environment and “off” in the production environment).
  • log_errors - Indicates whether errors should be logged to a log file (usually “off” when “display_errors” is “on”, and vice versa).
  • report_memleaks - Indicates whether the bursts of memory should be shown/logged (usually “on”).
  • memory_limit - amount of memory reserved for PHP during script execution. Normally a simple script needs no more than 10M, but some require much more than that. The directive must be set to a reasonable value for the expanded application and, in cases of tools that require more memory. To evaluate memory usage, see the functions memory_get_peak_usage and memory_get_usage.
  • max_execution_time - Sets the maximum time the script can run before it is aborted automatically by PHP (usually “30″, but can be configured with higher values ​​for heavier tools).
  • precision - Sets the precision of decimal places for real numbers (usually 14).
  • date.timezone - Sets the default timezone of the application (eg “America / Sao_Paulo”)
  • default_mimetype - Sets the mimetype of files generated by PHP which have left with the explicit call to header (‘Content-type: …’) (eg “text/html” or “application/xhtml+xml”).
  • default_charset - Sets the default charset of the files generated by PHP which have left with the explicit call to header (‘Content-type: …; charset = …’).
  • short_open_tag - Defines whether the application will accept the abbreviated notation of PHP tags: “<?” and “?>” (recommended “on” only in closed applications whose portability is not important).
  • aps_tags - Defines whether the application will accept the notation ASP to PHP tags “<%” and “%>” (recommended “on” only in closed applications, where portability is not important).
  • register_globals - Defines whether the application will create global variables to values ​​derived from EGPCS (Environment, GET, POST, Cookie, Server). It is strongly recommended to use “off” because it is a deprecated feature which makes the application more prone to security breaches.
  • magic_quotes_runtime and magic_quotes_gpc - sets whether addslashes automatically applied on the data submitted. It is strongly recommended to use “off” because it is a deprecated feature and featuring a performance disadvantage.
  • arg_separator.output - Separator used by standard PHP functions that build URL. It is recommended “&”, especially for applications XHTML).
  • session.auto_start - Automatically log (usually “off”)
  • session.use_cookies - Indicates whether sessions can use cookies to store session keys (recommended “on”).
  • session.use_only_cookies - Indicates whether sessions can only use cookies to traffic session keys, rather than inform them via GET (it is strongly recommended “on” for security reasons).
  • session.use_trans_sid - Indicates whether sessions can use the mechanism of “transparent sid” to travel the session keys (data passed by GET) (it is strongly recommended “off” for security reasons).
Mar 28

Problems with charset? Never again.

In this article we will see how to use UTF-8 at all and never see characters being displayed wrong.

1.  Save the source code in UTF-8

First of all, choose a good source code editor that allows you to define which encoding used in saved files. Normally this is the editor settings or options of saving time. If you use text mode editors, you may need to configure it in the settings of the terminal command (gnome-terminal, xterm, etc.).Note: some publishers have option to save the file with the BOM. It is recommended that doesn’t include these bytes, because they can cause unexpected behavior in PHP. For example, you will not be able to call functions such as header or use the namespace feature, which requires that the namespace declaration is the first thing in the script. 

2. Tell the browser that you use UTF-8
When a PHP file and generates a HTML is sent to the browser, along with the file go to header (HTTP protocol), where you specify the file type and encoding. If you don’t report it explicitly in your code, your HTTP server (for example, Apache) will send this file with a mime-type pattern (usually “text/html”) and a default encoding (usually “ISO-8859-1 “).To change this header explicitly, and properly inform the mime-type and encoding of the document you are creating, use the header function, passing the policy “Content-type” as such: 


If the file is of another type, just change the mime-type to the corresponding type (eg “text/css”, “text/xml”, “application/xhtml+xml”, etc).

However, the files aren’t always generated via PHP. There are static HTML you need to inform the HTTP header with the mime-type and correct coding. In this case, there is an alternative that is using the meta tag with the attribute “http-equiv” (equivalent HTTP). With it, you can “simulate” HTTP header by the contents of the HTML document. This is done as follows:

In HTML 5, it was simplified:

If you use XML or XHTML, remember to inform the UTF-8 encoding in the XML header:

 

 3. Communicate with the BD via UTF-8

For information to be trafficked between PHP and the database using UTF-8, you must declare this encoding logo that connects to the database. This varies from bank to bank, but let’s see some common examples: 

MySQL (PDO):


MySQLi:

MySQL (functions):

Note: the connection to MySQL functions are deprecated. Prefer to use PDO or MySQLi.

PostgreSQL (PDO):

 PostgreSQL (functions):

 

 4. Create your database in UTF-8
The text fields stored in databases also need a character encoding. If it isn’t defined when you create the field, the default encoding is taken from the table or from the database. To set a default encoding of a database, use the command:
MySQL:

 PostgreSQL:

 5 Remember to specify the UTF-8 which you can

Some functions in PHP receive as parameter encoding to be considered. Some of the most important things that should be highlighted are: htmlentities and htmlspecialchars.Furthermore, when performing operations with regular expressions PCRE, remember to use the modifier “u” at the end of the expression, indicating that it is UTF-8, as an example: 


An important set of functions takes into account the location (with encryption) to function. So it is also important to properly set the locale to locale UTF-8:

Remember that the location depends on the server and the name used may vary.

Conclusion:
Taking the necessary steps, you can use UTF-8 with no big problems at all layers of their system: in HTML, PHP and database. Problems with charset? Never again!

Mar 19

PHP in interactive mode

php

 

Although PHP is specially designed to meet Web requests, it can also be run in a terminal prompt  through php cli. At the terminal, we can run it in different ways, and in this post we will see what they are.

Running a script by terminal:

To run a PHP script from the terminal, just run the command “php” followed by the path to the file to be executed.

 

Running a PHP code by terminal:

To run a PHP code through the terminal, just run the command “php” passing the “-r” parameter, followed by the command to be executed. Note that the command must be delimited by single or double quotes. You may not use the PHP code delimiters to delimit commands (like <? Php and?>), Although you can close it and open it again. Here’s an example:

This can be useful for performing rapid tests for the small terminal, without the need to create a script only to see the result.

One drawback is that if you use double quotes, and you want to run any command involving variables, you need to escape the “$” symbol. Also, if you want to use the same quotes used to delimit the command also needs to escape it, like this:

Note that we can execute more than one command. Simply enclose them by “;”.

Running a PHP code by interactive terminal:

To perform a sequence of PHP codes through the terminal, interactively, simply run the “php” passing the parameter “-a”.

When executing this command, a prompt will be shown in PHP, as shown below:

 

In PHP prompt, you can run PHP commands and the result is shown how a command is completely interpreted. In this case, we can create variables, run loops and print results more easily than the previous form (with “-r”). That’s because we don’t need to worry about escaping quotes and variables.

See an example of a loop executed at the interactive prompt:

 

Note that after adding the first line, we opened a key. With this, the PHP changes the prompt to “php {“. So we closed the keys, the third row inserted, PHP executes the entire block set.

To end the interactive mode, simply run the command “exit” or “quit”. Note that it is different from running the PHP command “exit (0);”. In this case, only the value being set is returned to the shell.

Mar 15

PHP SQL Server – Scriptcase 7 is out!

PHP SQL Server – The new version  of Scriptcase 7 came out in January!

With it came many improvements like Dynamic Group By, HTML 5 Charts, Integration with Social Networks, Upload multiple files, Export PDF in Forms, LDAP security, Menus for mobile devices and more!

See a list with some of the new features:

 

  • SQL PDO Drivers (MySQL, PostgreSQL, SQLServer)
  • Toolbar option
  • Mobile menu support
  • Integration: PayPal, Facebook, Google+, Twitter
  • Grid Ajax events
  • PDF export on forms
  • Progress Bar/Drag’n Drop Upload
  • Multiple Upload
  • HTML5 Charts
  • Javaless PDF generator
  • Reworked GroupBy with Multiple Rules
  • Percent(%) field
  • Single-record-detail on master/detail
  • LDAP Support for security module
  • Scriptcase Macros improvement
  • New Scriptcase Macros created

Check more about Scriptcase 7 at: www.scriptcase.net

PHP SQL Server Blog