Home > PHP > Function > MySQL > mysql_db_query()

mysql_db_query()

mysql_db_query - Send a MySQL query

Syntax

resource mysql_db_query (string $database, string $query, resource $link_identifier)

Arguments

  • database - The name of the database that will be selected.
  • query - The MySQL query. Data inside the query should be properly escaped.
  • link_identifier - The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an E_WARNING level error is generated.

Description

mysql_db_query() selects a database, and executes a query on it.

Version

PHP 4, 5

Return value

Returns a positive MySQL result resource to the query result, or FALSE on error. The function also returns TRUE / FALSE for INSERT/ UPDATE/ DELETEqueries to indicate success/failure.