Oracle 5.0 Reference Manual page 2278

Table of Contents

Advertisement

Return Values
Returns the error text from the last MySQL function, or
Examples
Example 20.36.
<?php
$link = mysql_connect("localhost", "mysql_user", "mysql_password");
mysql_select_db("nonexistentdb", $link);
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
mysql_select_db("kossu", $link);
mysql_query("SELECT * FROM nonexistenttable", $link);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
?>
The above example will output something similar to:
1049: Unknown database 'nonexistentdb'
1146: Table 'kossu.nonexistenttable' doesn't exist
See Also
mysql_errno
MySQL error codes
20.7.2.5.12.
mysql_escape_string
Copyright 1997-2012 the PHP Documentation Group. [2230]
mysql_escape_string
Escapes a string for use in a mysql_query
Description
string mysql_escape_string(
string unescaped_string);
This function will escape the unescaped_string, so that it is safe to place it in a mysql_query. This
function is deprecated.
This function is identical to
mysql_real_escape_string
Original MySQL API (Mysql)
with no arguments. If no connection is found or established, an
E_WARNING
example
mysql_error
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the
future. Instead, the
MySQLi
also
MySQL: choosing an API
Alternatives to this function include:
mysqli_escape_string
PDO::quote
mysql_real_escape_string
takes a connection handler and escapes the string according to the
level error is generated.
(empty string) if no error occurred.
''
or
PDO_MySQL
extension should be used. See
guide and
related FAQ
except that
2258
for more information.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents