mysql_errno()


返还MySQL服务器的错误应答的错误代码

Description

int mysql_errno()

Parameters

none

Return Value

有错误时返还错误信息,没有时0

Example

<?php
include_once "/lib/sn_dns.php";     // include DNS library
include_once "/lib/sn_mysql.php";

$server_addr = "192.168.0.100";     // IP address of MySQL server
$user_name = "user_id";             // MySQL ID
$password = "password";             // MySQL password

// connect to a MySQL server
if(mysql_connect($server_addr, $user_name, $password) === false)
    exit(mysql_errno());            // printing error code and quit

mysql_close();                      // disconnecting from the MySQL server
?>

See also