Forum Moderators: coopster

Message Too Old, No Replies

mysql error()

Why does it cause an error?

         

ahmedtheking

8:16 pm on Jan 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why is it that if you have:


$x = mysql_fetch_row(mysql_query("......") or die(mysql_error()));

more than once, it causes an error?

eelixduppy

8:34 pm on Jan 22, 2007 (gmt 0)



Because it is not correct syntax. You are better off splitting everything up as it makes it easier to read and debug:

$result = mysql_query("......") or die(mysql_error());
$x = mysql_fetch_row($result);

If you want to keep it the way you have it, it should look more like this:


$x = mysql_fetch_row(mysql_query("......")) or die(mysql_error());

ahmedtheking

8:57 pm on Jan 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, have you ever had an issue of having too many "or die" statements that caused errors when there weren't any?

eelixduppy

9:06 pm on Jan 22, 2007 (gmt 0)



No I haven't. If they are used correctly, they shouldn't behave abnormally.