<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >mysql_db_query</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="MySQL Functions" HREF="ref.mysql.html"><LINK REL="PREVIOUS" TITLE="mysql_db_name" HREF="function.mysql-db-name.html"><LINK REL="NEXT" TITLE="mysql_drop_db" HREF="function.mysql-drop-db.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.mysql-db-name.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.mysql-drop-db.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.mysql-db-query" ></A >mysql_db_query</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN66826" ></A ><P > (PHP 3, PHP 4 , PHP 5)</P >mysql_db_query -- Send a MySQL query</DIV ><DIV CLASS="refsect1" ><A NAME="AEN66829" ></A ><H2 >Description</H2 >resource <B CLASS="methodname" >mysql_db_query</B > ( string database, string query [, resource link_identifier])<BR ></BR ><P > Returns a positive MySQL result resource to the query result, or <TT CLASS="constant" ><B >FALSE</B ></TT > on error. The function also returns <TT CLASS="constant" ><B >TRUE</B ></TT >/<TT CLASS="constant" ><B >FALSE</B ></TT > for <VAR CLASS="literal" >INSERT</VAR >/<VAR CLASS="literal" >UPDATE</VAR >/<VAR CLASS="literal" >DELETE</VAR > queries to indicate success/failure. </P ><P > <B CLASS="function" >mysql_db_query()</B > selects a database and executes a query on it. If the optional link identifier isn't specified, the function will try to find an open link to the MySQL server and if no such link is found it'll try to create one as if <A HREF="function.mysql-connect.html" ><B CLASS="function" >mysql_connect()</B ></A > was called with no arguments. </P ><P > Be aware that this function does <SPAN CLASS="strong" ><B CLASS="emphasis" >NOT</B ></SPAN > switch back to the database you were connected before. In other words, you can't use this function to <SPAN CLASS="emphasis" ><I CLASS="emphasis" >temporarily</I ></SPAN > run a sql query on another database, you would have to manually switch back. Users are strongly encouraged to use the <VAR CLASS="literal" >database.table</VAR > syntax in their sql queries instead of this function. </P ><P > See also <A HREF="function.mysql-connect.html" ><B CLASS="function" >mysql_connect()</B ></A > and <A HREF="function.mysql-query.html" ><B CLASS="function" >mysql_query()</B ></A >. </P ><P > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > This function has been deprecated since PHP 4.0.6. Do not use this function. Use <A HREF="function.mysql-select-db.html" ><B CLASS="function" >mysql_select_db()</B ></A > and <A HREF="function.mysql-query.html" ><B CLASS="function" >mysql_query()</B ></A > instead. </P ></BLOCKQUOTE ></DIV > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.mysql-db-name.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.mysql-drop-db.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >mysql_db_name</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.mysql.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >mysql_drop_db</TD ></TR ></TABLE ></DIV ></BODY ></HTML >