Posts

Showing posts with the label PHP

Difference between PHP isset() vs empty() vs is_null()

isset() - Determine if a variable is set and is not NULL empty() - Determine whether a variable is empty is_null() - Finds whether a variable is NULL PHP has different functions which can be used to test the value of a variable. Three useful functions for this are isset(), empty() and is_null(). All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results. Value of variable ($var) isset($var) empty($var) is_null($var) “” (an empty string) bool(true) bool(true) ” ” (space) bool(true) FALSE bool(true) bool(true) TRUE bool(true) array() (an empty array) bool(true) bool(true) NULL bool(true) bool(true) “0″ (0 as a string) bool(true) bool(true) 0 (0 as an integer) bool(true) bool(true) 0.0 (0 as a float) bool(true) bool(true) var $var;  (a variable declared, but...

PHP Database Backup Script

Mysqldump is a small utility that allows you to export a MySQL database to a text file for backup or transfer between two servers. This utility is very useful, is not always available on shared hosting as it embarks on the command line. This article therefore discusses how to export a MySQL database in PHP. Called "export" the fact of formatting in a file (a dump) all the information needed to create the table and populate. The following code allows for an export of a database in SQL file. The Setup section allows you to configure the connection information to the database (user name, password and server address) and the name of the database ($ dbname). As you can see, the script regularly dump the memory by recording the information as and in the dump file. This process is required for export of large databases. Note also that the export of a large BDD can take a long time. If you can, consider raising the maximum execution time of your script at the beginning of ...

Pagination Full Example PHP - MYSQL

Image
Code :  http://pastebin.com/PKdbyT0A Database for mysql : http://downloads.mysql.com/docs/world_innodb.sql.zip