Welcome visitor
* Login
* Register
It is currently July 20th, 2019, 5:09 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Server Side » PHP



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  Sort Database Queries results
PostPosted: February 6th, 2009, 1:45 am 
User avatar

Posts: 61
Hi,
I have a database which I am accessing through PHP but I can't find out how to sort the entries by how recent they are... they just seem to appear in random order...
$search = mysql_query("SELECT user FROM Comments");
while($searchRow = mysql_fetch_array($search))
{echo $searchRow["name"];}


Top
 Profile  
 
  Re: Sort Database Queries results
PostPosted: February 6th, 2009, 1:53 am 
User avatar

Posts: 86
You may want to use the ORDER BY clause, the **** being the category to sort.
$search = mysql_query("SELECT user FROM Comments ORDER BY **** DESC");


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Server Side » PHP


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron