Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PHP]Quick Question about sorting

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
bheesham
Advanced Cheater
Reputation: 0

Joined: 08 Nov 2006
Posts: 88
Location: ::1

PostPosted: Tue May 13, 2008 2:47 pm    Post subject: [PHP]Quick Question about sorting Reply with quote

if i wanted to sort things by date... would it be something like

Code:

<?php
$sql="SELECT * FROM $tbl_name ORDER BY lastreply DESC";
$result=mysql_query($sql);
?>

IRRELEVANT CODE HERE

<?php
//$resultsort=mysql_query($sort);
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td bgcolor="#FFFFFF"><?php echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><a href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['view']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['reply']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['lastreply']; ?></td>
</tr>
<?php
}
mysql_close();
?>




I'm working on something for a friend.. just need to know if thos would work since i<?php
//$resultsort=mysql_query($sort);
while($rows=mysql_fetch_array($result)){ // Start looping table row
?>
<tr>
<td bgcolor="#FFFFFF"><?php echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><a href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['view']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['reply']; ?></td>
<td align="center" bgcolor="#FFFFFF"><?php echo $rows['lastreply']; ?></td>
</tr>
<?php
}
mysql_close();
?>

help?
Back to top
View user's profile Send private message Visit poster's website
Reak
I post too much
Reputation: 0

Joined: 15 May 2007
Posts: 3496

PostPosted: Wed May 14, 2008 4:58 am    Post subject: Reply with quote

Are you using a varchar in the MySQL-table for it?
It so, it wont work then.
Just use a 'date' variable and use the code you posted. But the date must by saved like this: yyyy-mm-dd .
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites