-{ Rene Brehmer }- wrote:

Thought it looked fishy .... hehe ...

My only problem is: Sometimes you actually need the data from that table later in the same script, so instead of doing another data pull, I have alot of cases where this is alot more useful (not actual code from any of my work, but I've used this structure in the past):

$query = mysql_query("SELECT $fields FROM $table WHERE $crit") or die('fetch error<br>'.mysql_error());

if (mysql_num_rows($query) > 0) {
  $result = mysql_fecth_array($query);
  // and so on ...
}

Use this code instead: if ($result = mysql_fetch_array($query)) { // do something }

BTW, pls remember that an array of nothing (array()) is FALSE when it is casted into boolean. The comparison '!== FALSE' is not necessary just because mysql_fetch_array does not return empty arrays.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to