mysql_db_query()
resource mysql_db_query(database,sql_statement[,connection])
This function can be used to query the database given—for the
current MySQL connection, unless another is specified—and to execute
the SQL statement given as the second argument. If there isn’t
currently a connection to the server, it will attempt to establish
one. For SQL statements that would not return a results set (e.g.,
UPDATE statements), the function will return true
if it’s successful and false if it’s unsuccessful. This function is
deprecated, so use mysql_query() instead.
Here is an example:
...
$sql_stmnt = "SELECT wrid, clientid, description
FROM workreq";
$results = mysql_db_query('workrequests', $sql_stmnt);
while($row = mysql_fetch_object($results)) {
print "WR-" . $row->wrid . ",
Client-" . $row->clientid . " " .
$row->description . "\n";
}
...Basically, using mysql_db_query()
eliminates the need to use mysql_select_db()
and mysql_query().