Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can't quite see what you're trying to do but what it looks like to me is that you want all the items from racks joined with their relevant device and displayed in order of deviceRU. Does this help:</p> <pre><code>echo "&lt;tr&gt;&lt;th colspan='3'&gt;&lt;center&gt;&lt;b&gt;$rackname&lt;/th&gt;&lt;/tr&gt;" ; $sql1 = "SELECT racks.rackID, racks.rackname, devices.deviceID, devices.deviceName, racks.rackRU, devices.deviceRU, devices.RUcount FROM racks LEFT JOIN devices ON racks.rackID = devices.rackID WHERE racks.rackID = '$rackID' AND devices.deviceRU &lt;= ".intval($RUtotal)." ORDER BY devices.deviceRU;" $query1 = mysql_query($sql1); while ($row = mysql_fetch_array($query1)) { $deviceru = $row['deviceRU']; $deviceID = $row['deviceID']; $device = $row['deviceName']; $deviceRUC = $row['RUcount']; echo'&lt;tr class="rackbg"&gt;&lt;td class="i"&gt;'.$i.'&lt;/td&gt;&lt;td class="device"&gt;&lt;a href="/devices.php?id='.$deviceID.'"&gt;'.$device.'&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;'; } </code></pre> <p>I've used a LEFT (inner) JOIN in the SQL instead of the outer join that was there before as it'll return less results and might solve your problem. I've ordered the results by deviceRU and only returned results which have deviceRU less than or equal to $RUtotal (as I think the example was showing).</p> <p>I've also removed the tags, these should be replaced by using CSS to centre either all td elements or centering class="device" and class="i" e.g.:</p> <pre><code>.device, .i { text-align: center; } </code></pre> <p>I've also swapped your abc to abc which is the correct format for a link.</p> <p>Could you describe more of the context as it's difficult to see your intention from your post.</p> <p>Mat</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload