Jump to content

php mysql order by timestamp


birdie

Recommended Posts

[code]
$sql = "SELECT * FROM matches ORDER BY sched ASC";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
{
$clan1 = $row['clan1'];
$clan2 = $row['clan2'];
echo $clan1." vs ".$clan2."<br>";
}
[/code]
that is my script.. this is my table

[code]
id|sched|sched_by|clan1|clan2|matchtype
[/code]
sched is where my timestamps are added but i have 1 problem.. when i try and use an order by statement, it doesnt work. any help is greatly appreciated! :-)

ps. yeah barand, thanks for the help i just need my news to be in order thats all :-)
Link to comment
https://forums.phpfreaks.com/topic/6884-php-mysql-order-by-timestamp/
Share on other sites

ok.. it echo's all of my timestamps in order.. tryed it like this next

[code]
$sql = "SELECT * FROM matches ORDER BY sched ASC LIMIT 20";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
{
$clan1 = $row['clan1'];
$clan2 = $row['clan2'];
echo $clan1."<br>";
}
[/code]

guess what, it didnt work.. hmm thanks though


edit:weird, now it doesnt work at all [a href=\"http://antrino.no-ip.info/beta/websites/UBF/devops/matches3.php\" target=\"_blank\"]http://antrino.no-ip.info/beta/websites/UB...ps/matches3.php[/a]

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.