Re: Nested mysql_query()'s
| From: | Shena Delian O'Brien | Date: | Tue, 01 Jul 2003 22:01:27 +0000 |
| Subject: | Re: Nested mysql_query()'s | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-153620@lists.php.net to get a copy of this message | ||
Sparky Kopetzky wrote:
Hi! I've got two nested queries where one looks up data based on values returned from the first.No... you don't even need to use a connect ID. It should work fine if you just use mysql_query($bid_query) The problem is likely that the query is failing for some reason and thus not generating a proper result. Do an echo mysql_error($CONNECT_ID) to figure out if there's an error in your syntax, etc.$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??