title: Adding DateDiff column to PHP table using MySQLI
body: <p>I'm trying to add a column to my database table that shows the difference between the timestamp and the current date. I've tried creating another query using DateDiff, but I'm not sure exactly what I'm doing wrong.
  Can anyone help?</p>
  
  <p>My code is below.</p>
  
  <pre><code>    &lt;?php
              $result = mysqli_query($con,"SELECT * FROM pokemon ORDER BY stats");
  
              echo "&lt;table border='1'&gt;
              &lt;tr&gt;
              &lt;th&gt;Pokemon Name&lt;/th&gt;
              &lt;th&gt;Type One&lt;/th&gt;
              &lt;th&gt;Type Two&lt;/th&gt;
              &lt;th&gt;Move One&lt;/th&gt;
              &lt;th&gt;Move Two&lt;/th&gt;
              &lt;th&gt;Move Three&lt;/th&gt;
              &lt;th&gt;Move Four&lt;/th&gt;
              &lt;th&gt;Stats&lt;/th&gt;
              &lt;th&gt;ID&lt;/th&gt;
              &lt;th&gt;Date Added&lt;/th&gt;
              &lt;th&gt;Days on File&lt;/th&gt;
              &lt;/tr&gt;";
  
              while($row = mysqli_fetch_array($result))
              {
                  $query = "SELECT DATEDIFF(CURDATE, $row[dAdded])FROM pokemon AS days";
                  $date =  mysqli_query($con, $query);
  
  
              echo "&lt;tr&gt;";
              echo "&lt;td&gt;" . $row['pName'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['type1'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['type2'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['move1'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['move2'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['move3'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['move4'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['stats'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['ID'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $row['dAdded'] . "&lt;/td&gt;";
              echo "&lt;td&gt;" . $date . "days&lt;/td&gt;";
              echo "&lt;/tr&gt;";
              }
              echo "&lt;/table&gt;";
          ?&gt;
  </code></pre>