RE: [PHP] accessing result set

From: Date: Tue, 27 Apr 2004 15:48:51 +0000
Subject: RE: [PHP] accessing result set
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184772@lists.php.net to get a copy of this message
just use a different variable name...i.e. $row and $row1. -----Original Message----- From: Matthew Oatham [mailto:matthewoatham@hotmail.com] Sent: Tuesday, April 27, 2004 11:40 AM To: php-general@lists.php.net Subject: [PHP] accessing result set Hi, I have 2 sql queries, after I run the second I stll want to get access to the 1st query result set is this possible? Here is a snippet of my code, I have hightlighted where I need access to the first result set. <? $sql = mysql_query("SELECT flight_id, flight_code, dep_airport_id, arv_airport_id, description FROM imp_flight"); if (mysql_num_rows($sql) > 0) { while ($row = mysql_fetch_array($sql)) { ?> <tr> <td><input type="text" name="flight_code[]" value="<?=$row['flight_code']?>" size="10"><input type="hidden" name="flight_id[]" value="<?=$row['flight_id']?>"></td> <td><textarea name="description[]" rows="5" cols="25"><?=$row['description']?></textarea></td> <td><select name="dep_flight_id[]"> <option value="0">Select</option> <? $sql1 = mysql_query("SELECT airport_id, icao_code FROM imp_airport order by icao_code asc"); while($row = mysql_fetch_array($sql1)) { foreach($row AS $key => $val) { $$key = stripslashes($val); } echo "<option value=\"$airport_id\" WANT TO ACCESS FIRST QUERY HERE SO I KNOW WHAT OPTION TO MARK AS SELECTED>$icao_code</option>\n"; } ?> ... Cheers Matt

« previous php.general (#184772) next »