QUOTE (top-designing @ Mar 2 2003, 01:37 PM)
Also do not use this kind of syntax
$row!=NULL also specify the format of how you would like the array to be indexed,
so the mysql_fecth_array must be like:
$row=mysql_fetch_array($result,MYSQL_ASSOC) and u will access the elements with $row['user']
or
$row=mysql_fetch_array($result,MYSQL_NUM) and u will access the elements with $row[1]
It is not a good idea to use defaults when u are programming.
it is not necessary, instead try to use this one
while ($row=mysql_fetch_array())
{
//Here you are able then to access
}
If u will need more just send me a PM
Whats wrong with it? mysql_fetch_array returns FALSE on no rows, with type conversion in PHP that will evaluate false on no rows. Its not using !== So it wil be fine, because types will be changed to match.
Actually, its easier to select it with out the type if more then one person is using it, some people prefer indexes(only good when selecting single fields, not whole rows), and others prefer associative arrays, so there for using mysql_fetch_array it will get both index and assoc, instead of specifying them.
By the looks of the query that she/he was doing it was a single one, so there for using a while() would slow it down(altough its not noticable), and be useless.
CODE
if($row=mysql_fetch_assoc($result))
{
}
would be better for single queries, but if there is a break or return needed, just use
CODE
$row=mysql_fetch_assoc($result) or return;
When connecting its always best to check if it did connect..