PHP

Pass Variable To Next Page Using Form In PHP

Example: page-1 $website_name = “tutorialstown.com”;

Posted in: PHP, Solutions

Enable PHP Short Tags

You can use short tags in PHP but it is a bad practice and not recommended by PHP developers. In some situations you may use these short tags. For enabling PHP short tags you need to turn them on in php.ini as following. After set them restart your apache server.

Posted in: PHP, Solutions

Email address validation in PHP

In Php there are many techniques to validate an email address such as regular expressions etc but the recommended technique is to use FILTER_VALIDATE_EMAIL because it gives us an easiest, safest and well formed way for email validation.

Posted in: PHP, Solutions

How to display syntax error messages in PHP?

To display php’s syntax errors you have to enable these errors first in the php.ini file because these errors are turned off by default. You can write the following code example to enable errors in your Php code file. Notice that, the following code can be written in php.ini file or direct in your Php […]

Posted in: PHP, Solutions

Encode MySQL query results to JSON in PHP

The functions Json_encode() only works with PHP 5.2 or greater versions with Php-Json loaded extension. Example: $record = mysqli_query(“SELECT computer_code FROM code_table”); $row_set = array(); while($row = mysqli_fetch_assoc($record)) { $row_set[] = $row; } echo json_encode($row_set);

Posted in: PHP, Solutions

How to prevent SQL-injection in PHP?

Use prepared statements and parameterized queries. These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an attacker to inject malicious SQL. Php5 and later versions have introduced two options to help us preventing from SQL injection. Using MySQLi (for MySQL):

Posted in: PHP, Solutions

Convert one date format into another in PHP

Use strtotime() to convert a date string into a timestamp. However, even strtotime() doesn’t recognize the y-m-d-h-i-s format. PHP 5.3 and greater: Use DateTime::createFromFormat. It allows you to specify an exact mask – using the date() syntax – to parse incoming string dates with. PHP 5.2 and lower: You will have to parse the elements […]

Posted in: PHP, Solutions

Can MySQL APIs to be mixed in PHP?

Posted in: PHP, Solutions
Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .