Problem was a fat-finger - meant 'bid' not 'bids'... Doh!!! Sparky - Thanks again.
----- Original Message ----- From: "Shena Delian O'Brien" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 01, 2003 16:01 Subject: [PHP] Re: Nested mysql_query()'s > Sparky Kopetzky wrote: > > 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?? > > 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. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php