Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The answer also depends on the way you'd like to show the info.</p> <p>If we assume you have the following six artist_id's in your DB</p> <pre><code>1,2,3,4,5,6 </code></pre> <p>in which way would you like to show them? This way</p> <pre><code>1 2 3 4 5 6 </code></pre> <p>or this way?</p> <pre><code>1 4 2 5 3 6 </code></pre> <p>Update: as you say you'd like to show them in the first way, the solution is pretty simple. Every pair iteration (0, 2, 4...) you should open the row and every odd iteration (1, 3, 5...) you should close it , so you'd have </p> <pre><code>&lt;tr&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;... </code></pre> <p>The code would be</p> <pre><code>&lt;?php $query = "SELECT * FROM `release` WHERE artist_id = '$rcode' AND label_id = '$id'"; $result = mysql_query($query); $tr_no = mysql_num_rows($result); $ii = 0; // Iterator while ($info = mysql_fetch_array($result)) { ?&gt; &lt;div&gt; &lt;table style="width: 100%"&gt; &lt;?php if ($ii%2 == 0) { // If pair, we open tr?&gt; &lt;tr&gt; &lt;?php } ?&gt; &lt;td &gt;&lt;img src="../artwork/&lt;?php echo $info['label_id']; ?&gt;/&lt;?php echo $info['ID']; ?&gt;.jpg" width="100" height="100" /&gt;&lt;/td&gt; &lt;td valign="top"&gt; &lt;table style="width: 100%"&gt; &lt;tr&gt; &lt;td style="width: 45px; height: 20px;" class="style5"&gt; &amp;nbsp;&lt;/td&gt; &lt;td style="width: 180px"&gt;&lt;?php echo $info['code']; ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 45px; height: 20px;" class="style5"&gt; &amp;nbsp;&lt;/td&gt; &lt;td style="width: 180px"&gt;&lt;?php echo $info['name']; ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 45px; height: 20px;" class="style5"&gt; &amp;nbsp;&lt;/td&gt; &lt;td style="width: 180px"&gt;&lt;?php echo trh($info['date']); ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 45px; height: 20px;" class="style5"&gt; &amp;nbsp;&lt;/td&gt; &lt;td style="width: 180px"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;?php if ($ii%2 == 1) { // If odd, we close tr?&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; &lt;/div&gt; &lt;?php $ii++; // We increment the iterator } ?&gt; </code></pre>
    singulars
    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. 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