string mysql_error(int [link_identifier]
);mySQL データベースバックエンドから返されるエラー、警告を出しません。 代わりに、エラー文字列を得るためにこれらの関数を使用します。
<?php
mysql_connect("marliesle");
echo mysql_errno().": ".mysql_error()."<BR>";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."<BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."<BR>";
?>
mysql_errno も参照下さい。