note 38350 modified in function.mysql-select-db by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Jun 2009 14:45:07 +0000 |
| Subject: | note 38350 modified in function.mysql-select-db by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156997@lists.php.net to get a copy of this message | ||
When you need to query data from multiple databases, note that mysql_select_db("db2")
doesn't prevent you from fetching more rows with result sets returned from "db1".
<?php
mysql_select_db("db1");
$res_db1=mysql_query("select * from foobar");
myqsl_select_db("db2);
$row_db1=mysql_fetch_object($res_db1);
$res_db2=mysql_query("select * from test where id='$row_db1->id'");
?>
--was--
When you need to query data from multiple databases, note that mysql_select_db("db2")
doesn't prevent you from fetching more rows with result sets returned from "db1".
mysql_select_db("db1");
$res_db1=mysql_query("select * from foobar");
myqsl_select_db("db2);
$row_db1=mysql_fetch_object($res_db1);
$res_db2=mysql_query("select * from test where id='$row_db1->id'");
http://php.net/manual/en/function.mysql-select-db.php