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
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.