Jump to content

[SOLVED] Ordering SQL results by date


Bifter

Recommended Posts

Hi All,

 

Hopefuly somone can point me in the right direction on this. Basicly I need a way of ordering the results of a SQL query by date in a html table:

 

<?php
mysql_select_db("ipendpoi_Purchase", $conn);
$result = mysql_query("SELECT * FROM po");
echo "<table width='100%' border='1'>
<tr>
<th>Date</th>
<th>PO Number</th>
<th>Requester</th>
<th>Amount</th>
<th>Vendor</th>
<th>Department</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['date'] . "</td>";
  echo "<td>" . "<a href=\"upload_directory/Purchase-Order-" . $row['number'] . ".pdf\">" . $row['number'] . "</a>" . "</td>";
  echo "<td>" . $row['requester'] . "</td>";
  echo "<td>" . "£"  . $row['amount'] . "</td>";
  echo "<td>" . $row['vendor'] . "</td>";
  echo "<td>" . $row['department'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($conn);
?> 

 

Thanks for looking.

Link to comment
https://forums.phpfreaks.com/topic/126731-solved-ordering-sql-results-by-date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.