Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple queries in one call...

Status
Not open for further replies.

Sleidia

Technical User
May 4, 2001
1,284
FR
Hello,

What is the most elegant way to send multiple queries
to a mysql DB in one single call (without the need to
open/close a connection for each query)?

Thanks for helping!
 
You can send multiple queries in one connection... you don't need to open and close the connection all the time

Usualy you only need to open the connection in beggining of the page, and you close it in the end, and between you do all the queries.

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
What in the hell?

You can always do this:

$conn=mysql_connect(server,login,password);
mysql_select_db(database);

$res1=mysql_query("SELECT count(1) from table");
$res2=mysql_query("INSERT INTO table VALUES (id,title)");

list($count)=mysql_fetch_row($res1);
mysql_disconnect($conn);

Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top