Page 1 of 1

mysql_query - does link identifier need to be specified?

Posted: Tue Oct 21, 2003 10:15 am
by Jean-Yves
Hi,

Having read the manual, I'm pretty sure that the answer is no, but could someone confirm that given the connection code below, I don't need to specify a link identifier in subsequent mysql_query calls, even in a multi-user environment. I just want to be sure that when the manual says:
If link_identifier isn't specified, the last opened link is assumed. If no link is open, the function tries to establish a link as if mysql_connect() was called with no arguments, and use it.

Code: Select all

$link = mysql_connect("localhost", "xxxxxx", "xxxxxx") or die("Unable to establish connection<br/>");

    mysql_select_db("xxxxxx") or die("mySQL: Unable to select database<br/>");
So, if person A creates a link to the database and is assigned a handle, and person B also connects, A's handle won't be confused with B's.

Many thanks

Posted: Tue Oct 21, 2003 10:18 am
by markl999
Yeah you generally don't have to bother specifying the connection handle. The only time you might want to is if you have say 2 connections to different databases.

Posted: Tue Oct 21, 2003 10:35 am
by Jean-Yves
Cheers Mark, that makes my life a lot easier :)