Saturday, 6 February 2016

How to Check MySQL Null on PHPIn Feburary 2016 06,

In Feburary 2016 06,
Open your PHP source file in a text editor, such as Windows Notepad.
Use the 'mysql_query(query)' function to send a MySQL query to the active database. For example, '$result=mysql_query('Select my_var from my_table');'.
Use the 'mysql_fetch_assoc(result)' function inside a 'while' loop to fetch rows from the MySQL result. For example, 'while ($my_values=mysql_fetch_assoc($result)) {'.
Use the 'is_null(variable)' function inside the 'while' loop to determine if a field from a returned row has a NULL value. For example, if (is_null($my_values['my_var'])) { echo 'is NULL'; } }' will print 'is NULL' for any values of 'my_var' that are NULL.
Save the PHP file.
In Feburary 2016 06,

No comments:

Post a Comment