Jump to content

[SOLVED] display last 5 users registerd


stelthius

Recommended Posts

Hello guys,

 

I have made a little code to display the last user registered now i want to alter it to show the last 5 users registerd but it seems no matter how i try and do this it doesnt want to work, my snippet is below..

 

<?php
include('include/session.php');

$new = mysql_fetch_array(mysql_query("SELECT * FROM `users` ORDER BY `signupdate` DESC LIMIT 0, 1")); /* Gets the newest member */
echo "New Users : " . $new[username]; /* Displays newest member */

?>

 

 

Thanks Rick.

Link to comment
https://forums.phpfreaks.com/topic/137527-solved-display-last-5-users-registerd/
Share on other sites

<?php
include('include/session.php');

$res = mysql_query("SELECT * FROM `users` ORDER BY `signupdate` LIMIT 5"); /* Gets the newest member */

while ($row = mysql_fetch_assoc($res)) {
    echo "New User : " . $row['username'] . "<br />"; /* Displays newest member */
}
?>

 

Should get you what you want.

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.