Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay SQL table in PHP and compare values
    primarykey
    data
    text
    <p>I have this table:</p> <pre><code>+----+---------------------+----------+---------+---------+---------+ | id | date | client1 | client2 | client1 | client1 | +----+---------------------+----------+---------+---------+---------+ | 1 | 2013-04-17 16:15:46 | 8592 | 9786 | 6471 | 0 | | 2 | 2013-04-27 16:15:46 | 8617 | 9876 | 7130 | 40243 | | 3 | 2013-04-28 17:57:30 | 8617 | 9884 | 7211 | 41657 | | 4 | 2013-04-29 13:28:11 | 8616 | 9886 | 7270 | 42516 | +----+---------------------+----------+---------+---------+---------+ </code></pre> <p>And I display it in a PHP like this:</p> <pre><code> &lt;table width="800" border="0" cellspacing="3" cellpadding="3" style="margin-left:auto; margin-right:auto"&gt; &lt;tr&gt; &lt;th scope="col" style="text-align:center; font-weight:bold"&gt;Date&lt;/th&gt; &lt;th scope="col" style="text-align:center; font-weight:bold"&gt;Client 1&lt;/th&gt; &lt;th scope="col" style="text-align:center; font-weight:bold"&gt;Client 2&lt;/th&gt; &lt;th scope="col" style="text-align:center; font-weight:bold"&gt;Client 3&lt;/th&gt; &lt;th scope="col" style="text-align:center; font-weight:bold"&gt;Client 4&lt;/th&gt; &lt;/tr&gt; &lt;? $queryuv = mysql_query("SELECT * FROM com_information ORDER BY date ASC"); while ($resultuv=mysql_fetch_assoc($queryuv)) { $date=$resultuv['date']; $client1=$resultuv['client1']; $client2=$resultuv['client2']; $client3=$resultuv['client3']; $client4=$resultuv['client4']; ?&gt; &lt;tr&gt; &lt;th scope="row" style="text-align:left"&gt;&lt;?=$date?&gt;&lt;/th&gt; &lt;td style="text-align:center"&gt;&lt;?=number_format($client1,0,'.',',');?&gt;&lt;/td&gt; &lt;td style="text-align:center"&gt;&lt;?=number_format($client2,0,'.',',');?&gt;&lt;/td&gt; &lt;td style="text-align:center"&gt;&lt;?=number_format($client3,0,'.',',');?&gt;&lt;/td&gt; &lt;td style="text-align:center"&gt;&lt;?=number_format($client4,0,'.',',');?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;? } ?&gt; &lt;/table&gt; </code></pre> <p>What I would like to do, is in the table were I display the info, compair the value with the previous date from the same client, and place display how much did it grow or decrease.</p>
    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.
 

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