mysql_error

(PHP3 , PHP4 )

mysql_error --  直近に実行されたMySQLコールのエラーメッセージを返す

説明

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()も参照下さい。