Jump to content

loop proplem


hyster

Recommended Posts

i have a query nested in another query that takes a var from the 1st query

the 1st var uses 1 table and takes nested uses a 2nd.

 

the 2nd var produces a onlick alert box with the query results.

 

it all works fine if theres an entry there is no entry for the nested var in which case the 1st var dosent display.

 

ive moved the } for the nested above the 1st query's results it puts the table header and returned data into the table header.

 

hope this makes sense as i lost myself writting this.

(the code for the onclick wont work as i posted it. i formatted it like that so it didnt extend the page).

 

Thanks

<td > </td>
<table  class="tableresult" align="center">
<tr class="tablehead1">
<td></td>
<td class="tdhdr" ><div align="center">Rsku</div></td>
<td class="tdhdr"> <div align="center">Osku</div></td>
<td class="tdhdr"> <div align="center">Make</div></td>
<td class="tdhdr"> <div align="center">Model</div></td>
<td class="tdhdr"> <div align="center">Recovery</div></td>
<?php
// Start looping rows in mysql database.
while( $rows=mysql_fetch_array($result) ) {   
$rows = array_map('strtoupper', $rows);   


?>
<?php


//row colours


if    ($rows['auth'] == 'YES' and $rows['location'] == 'SERVER'){ 
$bgc = "pass" ; } 

elseif($rows['auth'] == 'YES' and $rows['location'] == 'HDD'){ 
$bgc = "wait" ;  

}else{
$bgc = "fail"; }

?>

<?php

$src = $rows['rsku'];
$sql10="SELECT * FROM safesku where rsku='$src' ";
$result10=mysql_query($sql10);
while( $rows10=mysql_fetch_array($result10) ) { 
?>
<tr id="tabledata" class="<?php echo "$bgc"; ?>" onclick="alert('Recon Sku <?php  echo $rows10['rsku']; ?>\r
Origanal Sku<?php  echo $rows10['orsku']; ?>\r
Make <?php  echo $rows10['make']; ?>\r
MOdel <?php  echo $rows10['model']; ?>\r
Year <?php  echo $rows10['year']; ?>\r
Quarter <?php  echo $rows10['qtr']; ?>\r
Colour <?php  echo $rows10['colour']; ?>\r 
cpu <?php  echo $rows10['cpu']; ?>\r
Ram <?php  echo $rows10['ram']; ?>\r
hdd <?php  echo $rows10['hdd']; ?>\r
Graphics <?php  echo $rows10['gfx']; ?>\r
Graphics Ram <?php  echo $rows10['gram']; ?>\r
screen <?php  echo $rows10['screen']; ?>\r
Oparating System <?php  echo $rows10['os']; ?>\r
Odd <?php  echo $rows10['odd']; ?>\r')">
<td ><?php
$img=mysql_num_rows($result10);
if($img >= 1){ 
echo "$img";
echo '<img src="http://localhost/dsgi/images/info.jpg" width=25 border=0>';
}else{
echo "empty";
}

?>
</td>
<td  class="tdhdr">  <?php  echo $rows['rsku']; ?></td>
<td  class="tdhdr">  <?php  echo $rows['orsku']; ?></td>
<td  class="tdhdr">  <?php  echo $rows['make']; ?></td>
<td  class="tdhdr">  <?php  echo $rows['model']; ?></td>
<td class="tdhdr" >  <?php  echo $rows['recovery']; ?></td>
<p>
  
  <?php
}
}
}
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/226282-loop-proplem/
Share on other sites

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.