Jump to content

[SOLVED] Resource id # error


inspireddesign

Recommended Posts

Hello all,

 

This is boggling me ???

 

In the below script I have an SQL statement within the below loop.  Before the SQL runs I see if the value $row_aircraft['aircraft_lh'] isn't NULL then grab the data each time the loop is run.  In some cases the value $row_aircraft['aircraft_lh'] may NOT be null in which case I don't don't run the SQL statement at all.

 

It seems to run the last $row in the SQL statement but the information before that gets ignored giving me an error. The output reads as follows:  Resource id #21First Merit Bank 106 South Main Street, 3rd. Floor Akron NE, 43062   

 

Any ideas??

 

<?php 

while ($row_aircraft = mysql_fetch_assoc($aircraftQ)) {	

$mm 	.= ' ' . $row_aircraft['aircraft_mm']. '\line'; 
$n 		.= ' ' . $row_aircraft['aircraft_n']. '\line' ;
$yr 	.= ' ' . $row_aircraft['aircraft_year']. '\line' ;
$seats 	.= ' ' . $row_aircraft['aircraft_seats']. '\line' ;

	 if ($row_aircraft['aircraft_use_ncbp'] !=NULL) { $uses  .= '(A)\line'; }
	 if ($row_aircraft['aircraft_use_ncia'] !=NULL && $row_aircraft['aircraft_use_ncbp'] !=NULL) { $uses .= '(A) (B)\line'; }
	 if ($row_aircraft['aircraft_use_cmInput'] !=NULL) { $uses .= ' (C)\line'; }
	 if ($row_aircraft['aircraft_use_spInput'] !=NULL) { $uses .= ' (D)\line'; }

$hba 	.= ' ' . $row_aircraft['aircraft_base_name']. ', ' . $row_aircraft['aircraft_base_state']. ' : ' . $row_aircraft['aircraft_base_id'].'\line' ;

// ********** Problem Area producing the error (below) *********************	

 if ($row_aircraft['aircraft_lh'] != NULL) { 

			$query_lh = "SELECT * FROM lh WHERE lh_id = ".$row_aircraft['aircraft_lh']."";
			$lh = mysql_query($query_lh, $contacts) or die(mysql_error());
			$row_lh = mysql_fetch_assoc($lh);

$lhy   .= ' '.'Y\line';

$lh 	.= $row_lh['lh_bank']. ' ' .$row_lh['lh_street']. ' '. $row_lh['lh_city']. ' '. $row_lh['lh_state']. ', '. $row_lh['lh_zip']. '\line'; 

} else { 

        $lhy   .= ' '.'\line'; 

       } 

}

?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/164578-solved-resource-id-error/
Share on other sites

            $lh = mysql_query($query_lh, $contacts) or die(mysql_error());

....

 

  $lh    .= $row_lh['lh_bank']. ' ' .$row_lh['lh_street']. ' '. $row_lh['lh_city']. ' '. $row_lh['lh_state']. ', '. $row_lh['lh_zip']. '\line';

 

You are using $ih as the result resource from the query and then concatenating the bank/street/city/state/zip on to that.

 

I'm going to guess the second highlighted variable above should have been $lhy

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.