Jump to content

Archived

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

birdie

php mysql order by timestamp

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 :-)

Share this post


Link to post
Share on other sites
What do you get if you run this

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.