Jump to content

Problem with PHP and MySQL


raptormx

Recommended Posts

Ok my problem is like next :

Im trying to create a PHP based website with MySQL as database...

How i can order news by a datetime?

I want that news show in news area like newest post first and then 2nd newest and so on...

Can anyone help me with this problem...

And it would be good if someone can post a script for ordering news like that...
Link to comment
https://forums.phpfreaks.com/topic/11480-problem-with-php-and-mysql/
Share on other sites

[!--quoteo(post=381337:date=Jun 8 2006, 03:40 PM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Jun 8 2006, 03:40 PM) [snapback]381337[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You need to have a timestamp inserted into your database using the time() function.

Then, when you query your news table for stuff, do it like this

"SELECT * FROM news ORDER BY datetime DESC LIMIT 10"
[/quote]

How i exactly use time() function?

EDIT : hmm no need answer, i got it work now :D

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.