Use of Resource link_identifier in mysql_query
Posted: Sat Aug 07, 2004 5:06 am
I have two diferent connections :
$Con1=mysql_connect($IP1,$Username1,$Password1);
$Con2=mysql_connect($IP2,$Username2,$Password2);
mysql_select_db($db1,$Con1);
mysql_select_db($db2,$Con2);
This what I tried to do:
$Res1=mysql_query($sql1,$Con1);
$Res2=mysql_query($sql2,$Con2);
All this time I coudn't figure out why it was failing then I found out that I need to select the db again when switching connections :
mysql_select_db($db1,$Con1);$Res1=mysql_query($sql1,$Con1);
mysql_select_db($db2,$Con2);$Res2=mysql_query($sql2,$Con2);
Then only it would work alright. Then whats the point of having the optional resource link_identifier argument in mysql_query() if we need to select_db each time ?
Thanks
$Con1=mysql_connect($IP1,$Username1,$Password1);
$Con2=mysql_connect($IP2,$Username2,$Password2);
mysql_select_db($db1,$Con1);
mysql_select_db($db2,$Con2);
This what I tried to do:
$Res1=mysql_query($sql1,$Con1);
$Res2=mysql_query($sql2,$Con2);
All this time I coudn't figure out why it was failing then I found out that I need to select the db again when switching connections :
mysql_select_db($db1,$Con1);$Res1=mysql_query($sql1,$Con1);
mysql_select_db($db2,$Con2);$Res2=mysql_query($sql2,$Con2);
Then only it would work alright. Then whats the point of having the optional resource link_identifier argument in mysql_query() if we need to select_db each time ?
Thanks