B&T
7-14-03, 12:31 AM
I have this:
$query = mysql_query("UPDATE $table SET $vote = $vote + 1 WHERE id=$id") or sql_error("vote","mysql_error()");
but the error routine sql_error does not get the error information, instead it gets the words "mysql_error()".
I have tried in and out of quotes with a .$query. cannot get the error information passed.
Anyone know the correct syntax for this?
Second question:
I have this:
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM $table"),0);
which works fine. but I would like to put an "or sql_error( . . . . )" in that statement as well. I have tried different things, none of which work.
Anyone know the correct syntax for that?
Just trying to clean up some of my code so I trap all of my potential errors.
$query = mysql_query("UPDATE $table SET $vote = $vote + 1 WHERE id=$id") or sql_error("vote","mysql_error()");
but the error routine sql_error does not get the error information, instead it gets the words "mysql_error()".
I have tried in and out of quotes with a .$query. cannot get the error information passed.
Anyone know the correct syntax for this?
Second question:
I have this:
$count = mysql_result(mysql_query("SELECT COUNT(id) FROM $table"),0);
which works fine. but I would like to put an "or sql_error( . . . . )" in that statement as well. I have tried different things, none of which work.
Anyone know the correct syntax for that?
Just trying to clean up some of my code so I trap all of my potential errors.