While ($ rs = mysql_fetch_array ($ result) 1. you do not need to move the record pointer to this loop. Can we read records cyclically? 2. does the expression $ rs = mysql_fetch_array ($ result) return TRUE, or if $ RS has a value, it is equivalent to TRUE while ($ rs = mysql_fetch_array ($ result ))
1. you do not need to move the record pointer to this loop. Can we read records cyclically?
2. is the expression $ rs = mysql_fetch_array ($ result) TRUE returned, or is it equivalent to TRUE when $ RS has a value.
Thank you ..
------ Solution --------------------
If $ rs is always true, isn't it an endless loop ?, Therefore, when the array is obtained, the value of $ rs is true. when the array is read, $ rs is null, which is false. I'm a newbie, so I understand
------ Solution --------------------
Mysql_fetch_array () is an extension of mysql_fetch_row.
Mysql_fetch_row () retrieves a row of data from the result set associated with the specified result ID and returns it as an array. Each result column is stored in an array unit, and the offset starts from 0. Call mysql_fetch_row () in sequence to return the next row in the result set. If no more rows exist, FALSE is returned.
------ Solution --------------------
Discussion
If the expression has a value, can it be considered TRUE?
------ Solution --------------------
Of course, if there is a value, the returned array will be equivalent to true.
------ Solution --------------------
Characters can be converted from BOOL,
Use two !! Can be converted to BOOL (TRUE)
PHP code
Echo !! $ Rs = mysql_fetch_array ($ result); // returns 1, indicating that there is a value. If no value is returned, no value is returned.