Oracle 5.0 Reference Manual page 2274

Table of Contents

Advertisement

link_identifier
Return Values
Returns a positive MySQL result resource to the query result, or
returns
/
for
TRUE
FALSE
Changelog
Version
5.3.0
4.0.6
Examples
Example 20.33.
mysql_db_query
<?php
if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
echo 'Could not connect to mysql';
exit;
}
if (!mysql_select_db('mysql_dbname', $link)) {
echo 'Could not select database';
exit;
}
$sql
= 'SELECT foo FROM bar WHERE id = 42';
$result = mysql_query($sql, $link);
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row['foo'];
}
mysql_free_result($result);
?>
Notes
Note
Be aware that this function does NOT switch back to the database you were
connected before. In other words, you can't use this function to temporarily
run a sql query on another database, you would have to manually switch back.
Users are strongly encouraged to use the
queries or
Original MySQL API (Mysql)
The MySQL connection. If the link identifier is not specified, the
last link opened by
is found, it will try to create one as if
with no arguments. If no connection is found or established, an
level error is generated.
E_WARNING
INSERT/UPDATE/DELETE
alternative example
mysql_select_db
2254
is assumed. If no such link
mysql_connect
mysql_connect
on error. The function also
FALSE
queries to indicate success/failure.
Description
This function now throws an E_DEPRECATED
notice.
This function is deprecated, do not use
this function. Use
mysql_select_db
instead.
mysql_query
database.table
instead of this function.
was called
and
syntax in their sql

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents