accessing result set
| From: | Matthew Oatham | Date: | Tue, 27 Apr 2004 15:39:37 +0000 |
| Subject: | accessing result set | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184771@lists.php.net to get a copy of this message | ||
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