multiple database connection
on windows 98 , mysqld running with pws
here is some confusion with the multiple database
connection variables
i am executing the same code in three different ways
it gives me diffrent output
all the database and table are exsists
method 1
------------------
<?php
$weblink=mysql_pconnect("www","root","");
echo mysql_select_db("runwayonline",$weblink);
echo "Web Link : ".$weblink."<br>";
$locallink=mysql_pconnect("www","root","");
echo mysql_select_db("dpsoff",$locallink);
echo "Local Link : ".$locallink."<br>";
$mysql1="select count(*) as c from members";
$rset=mysql_query($mysql1,$weblink);
$rrow=mysql_fetch_array($rset);
echo $rrow["c"]."<br>";
mysql_free_result($rset);
$mysq1="select count(*) as c from stumaster";
$rset=mysql_query($mysq1,$locallink);
$rrow=mysql_fetch_array($rset);
echo $rrow["c"]."<br>";
mysql_free_result($rset);
?>
output :-->
1Web Link : Resource id #1
1Local Link : Resource id #2
Warning: Supplied argument is not a valid MySQL result
resource in C:\Inetpub\webpub\multipleconn.as on line
12
Warning: Supplied argument is not a valid MySQL result
resource in C:\Inetpub\webpub\multipleconn.as on line
14
917
---------------------------
method 2
------------------
<?php
$weblink=mysql_pconnect("localhost","root","");
echo mysql_select_db("runwayonline",$weblink);
echo "Web Link : ".$weblink."<br>";
$locallink=mysql_pconnect("www","root","");
echo mysql_select_db("dpsoff",$locallink);
echo "Local Link : ".$locallink."<br>";
$mysql1="select count(*) as c from members";
$rset=mysql_query($mysql1,$weblink);
$rrow=mysql_fetch_array($rset);
echo $rrow["c"]."<br>";
mysql_free_result($rset);
$mysq1="select count(*) as c from stumaster";
$rset=mysql_query($mysq1,$locallink);
$rrow=mysql_fetch_array($rset);
echo $rrow["c"]."<br>";
mysql_free_result($rset);
?>
output -->
1Web Link : Resource id #1
1Local Link : Resource id #2
160
917
----------------------------------
Method 3
--------------------
<?php
$weblink=mysql_pconnect("www","root","");
echo mysql_select_db("runwayonline",$weblink);
echo "Web Link : ".$weblink."<br>";
$mysql1="select count(*) as c from members";
$rset=mysql_query($mysql1,$weblink);
$rrow=mysql_fetch_array($rset);
echo $rrow["c"]."<br>";
mysql_free_result($rset);
$locallink=mysql_pconnect("www","root","");
echo mysql_select_db("dpsoff",$locallink);
echo "Local Link : ".$locallink."<br>";
$mysq1="select count(*) as c from stumaster";
$rset=mysql_query($mysq1,$locallink);
$rrow=mysql_fetch_array($rset);
echo $rrow["c"]."<br>";
mysql_free_result($rset);
?>
output -- >
1Web Link : Resource id #1
160
1Local Link : Resource id #3
917
---------end----------
what is the difference in all the methods and why the
output diferent
if i use the connect in place of pconnect it gives the
same value of the $link variables
=====
-------------------
C-97 , shastri nagar,Opp. PNB,
jodhpur.Raj ( india ) - 342001
PHONE : 91-0291-5108074 , 75
-------------------
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php