The mysql_fetch_array () function can be used to determine whether mysql forms are empty in php. The following describes this method for your reference.
To determine whether the mysql form is empty, php does not have a direct function, but we can use the return value of the mysql_fetch_array () function to determine whether the mysql form is empty.
For example.
Method 1:
- $ SQL = "select * form abc"
- $ Result = mysql_query ($ SQL );
- $ Row = mysql_fetch_array ($ result );
- If (empty ($ row) // start to judge whether it is null
- {
- Echo "null ";
- }
- Else
- {
- Echo "not null ";
- }
Method 2:
- $ SQL = "select * form abc"
- $ Result = mysql_query ($ SQL );
- $ Row = mysql_fetch_array ($ result );
- If (! $ Row) // It is null enough to start judgment.
- {
- Echo "null ";
- }
- Else
- {
- Echo "not null ";
- }
- /*************************************** *********/
In fact, when the mysql_fetch_array function is used, if the table is an empty table, false is returned. At this time, $ row is not successfully assigned a value.
Remember, never dare to use $ row = mysql_fetch_array ($ result) or die (mysql_error () like this ());
If there is or die next to it, the execution of mysql_fetch_array will be terminated.
MySQL string case-sensitive Conversion Function
Use of MySQL concat Functions
Obtain the Automatically increasing MySQL primary key
MySQL primary key design principles
Advantages of MySQL partitioning