PHP Manual
Prev |  | Next

# 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.

    <?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>";
    ?>

See also: mysql_errno()

Prev | Home | Next
mysql_errno | Up | mysql_fetch_array