mysql_error

mysql_error -- Returns the text of the error message from previous MySQL operation

Description

string mysql_error(int [link_identifier] );

Errors coming back from the mySQL database backend no longer issue warnings. Instead, use these functions to retrieve the error string.

  1 
  2 <?php
  3 mysql_connect("marliesle");
  4 echo mysql_errno().": ".mysql_error()."<BR>";
  5 mysql_select_db("nonexistentdb");
  6 echo mysql_errno().": ".mysql_error()."<BR>";
  7 $conn = mysql_query("SELECT * FROM nonexistenttable");
  8 echo mysql_errno().": ".mysql_error()."<BR>";
  9 ?>
 10       

See also: mysql_errno()