I have a phone message page built and the information is stored in the MySql database.
I want to be able to sort the date so if a new messages gets added you have the ability to see by the most recent date.
as it is right now its a jumbled mess and you cant figgure out a new message cause everything is out of order.
I know how to sort an array, but how would I just do a normal sort on a date or name etc?
Here is the code.
<head>
<title>Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
/ Connecting, selecting database /
$link = mysql_connect("10.1.1.9", "test", "12345")
or die("Could not connect");
echo "Connected successfully";
mysql_select_db("message") or die("Could not select database");
/* Performing SQL query */
$query = "SELECT * FROM message_table";
$result = mysql_query($query) or die("Query failed");
/* Printing results in HTML */
print "<table border=1><tr><td><strong>For</strong></td><td><strong>From</strong></td><td><strong>Phone</strong></td><td><strong>Fax</strong></td><td><strong>Message</strong></td><td><strong>Signed</strong></td><td><strong>Date</strong></td><td><strong>Time</strong></td></tr>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td>$col_value</td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
/* Free resultset */
mysql_free_result($result);
?>
<br>
<a href="form.html">Enter New Message</a>
</body>