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