mysql_errno()

It returns the error number of the last MySQL operation

Example

<?php
$conn = mysql_connect(“localhost”, “root”, “password”) or die(mysql_errno());
?>