Jump to content

Latest Member in DB.


unsider

Recommended Posts

I am trying to add a feature to my website, and I'm curious how you would select the last entry or last id from your DB table and output the $username.

 

I will be checking this again soon, but I've gotta go, and would like to work on it when I get back.

 

Thanks.

Link to comment
Share on other sites

well every type of usage will have have it's features, using ID will force sorting the users by exactly when they registred, wether they changed the registration date or not, but using timestamp will give you this option...

 

yep, it's okay, but if go to errors then you can echo the query into the HTML page and paste it into phpmyadmin, it will give you the error if there's any one :)

Link to comment
Share on other sites

I should probably post the correct coding if anyone stumbles upon this later.

 

$query  = "SELECT username FROM users ORDER BY TIMESTAMP DESC LIMIT 1";
$result = mysql_query($query) or die('Error, query failed');

echo "$result";

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.