string mysql_error([resource $res])
(PHP 4, PHP 5)
| $res | The database connection resource that we want to use. |
|---|---|
| RETURNS | A human-readable error message for the last MySQL error generated. |
Creates a human-readable error message for the last MySQL error generated. Use this to debug database query errors in your page. If the optional parameter $res is left out, the function will use the last database resource opened by the script.
// open the mysql resource $res = mysql_connect($server, $user, $pass); // insert a single row into tblState mysql_query('INSERT * INTO tblState (\'California\')', $res); // return the number of rows $rows = mysql_affected_rows($res);