I can not understand what this condition literally means:
if($data=mysql_fetch_row($res)) { }
This condition is part of the id check.
The $res
variable contains an array with the result of mysql_query
.
Call the mysql_fetch_row method, which returns the next line of the result, and save it to the data variable. If what is stored in data is not equal to FALSE (that is, there are no more records), then the condition is true.
This can be rewritten so:
$data=mysql_fetch_row($res); if($data) { }
In your case, apparently, only one record is checked.
This recording format is quite popular, it allows you to save one, and sometimes two lines, although readability usually suffers a lot.
See the office. documentation, it clearly states what the function is and what it returns http://php.net/manual/ru/function.mysql-fetch-row.php
Specifically, this condition checks whether there is still data to be sampled from the database.
Source: https://ru.stackoverflow.com/questions/364225/
All Articles