Forum Moderators: coopster
Here is my code:
$query = "(SELECT id, prod_code, air_quantity, neck_size, area, neck_velocity, total_pressure, static_pressure, noise_levels, air_throw FROM dco_ls WHERE air_quantity < $air_quantity ORDER BY id DESC LIMIT 2) UNION (SELECT id, prod_code, air_quantity, neck_size, area, neck_velocity, total_pressure, static_pressure, noise_levels, air_throw FROM dco_ls WHERE air_quantity >= $air_quantity ORDER BY id ASC LIMIT 2) ORDER BY air_quantity ASC ";
$result = mysql_query($query, $dragon) or die(mysql_error());
$totalRows = mysql_num_rows($result);
do { ?>
<table width="950" border="0" cellpadding="0" cellspacing="0" id="table_selection_results">
<tr><td width="80" align="left" valign="middle"><?php echo $row ['prod_code']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['neck_size']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['area']; ?></td>
<td width="100" align="left" valign="middle"><?php echo $row ['neck_velocity']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['total_pressure']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['static_pressure']; ?></td>
<td width="100" align="left" valign="middle"><?php echo $row ['air_quantity']; ?></td>
<td width="110" align="left" valign="middle"><?php echo $row ['noise_levels']; ?></td>
<td width="100" align="left" valign="middle"><?php echo $row ['air_throw']; ?></td>
<td width="80" align="left" valign="middle"><input name="product_checked" type="checkbox" value="prod_checked" /></td></tr>
</table>
<?php } while ($row = mysql_fetch_assoc($result)); ?>
$row variable to contain the data. To fix this you are going to want to use just a regular while loop, such as the following:
while ($row = mysql_fetch_assoc($result)) {
?>
<table width="950" border="0" cellpadding="0" cellspacing="0" id="table_selection_results">
<tr><td width="80" align="left" valign="middle"><?php echo $row ['prod_code']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['neck_size']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['area']; ?></td>
<td width="100" align="left" valign="middle"><?php echo $row ['neck_velocity']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['total_pressure']; ?></td>
<td width="80" align="left" valign="middle"><?php echo $row ['static_pressure']; ?></td>
<td width="100" align="left" valign="middle"><?php echo $row ['air_quantity']; ?></td>
<td width="110" align="left" valign="middle"><?php echo $row ['noise_levels']; ?></td>
<td width="100" align="left" valign="middle"><?php echo $row ['air_throw']; ?></td>
<td width="80" align="left" valign="middle"><input name="product_checked" type="checkbox" value="prod_checked" /></td></tr>
</table>
<?php
}
Good luck. :)