Nested mysql_query()'s
| From: | Sparky Kopetzky | Date: | Tue, 01 Jul 2003 21:53:01 +0000 |
| Subject: | Nested mysql_query()'s | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-153618@lists.php.net to get a copy of this message | ||
Hi!
I've got two nested queries where one looks up data based on values returned from the first.
$lot_query = "SELECT * FROM LOT WHERE lot_category_id=" . $lot_category .
" AND lot_close_time>" . time();
$lot_result = mysql_query($lot_query, $CONNECT_ID);
if ($lot_result)
{
while ($row = mysql_fetch_array($lot_result))
{
blah-blah-blah...
$bid_query = "select * from bids where bid_lot_id=" . $lot_id .
" order by bid_amount";
$bid_result = mysql_query($bid_query, $CONNECT_ID);
$bid_count = mysql_num_rows($bid_result);
blah-blah-blah...
I get this error message: "Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource " from the second query. Do I need a second $CONNECT_ID for a second link to
mysql_query #2??
Robin E. Kopetzky
Black Mesa Computers/Internet Services
www.blackmesa-isp.net