divinedesigns1 Posted August 24, 2012 Share Posted August 24, 2012 hello, i am trying something new, well new for me that is, and im not sure how to go about doing this, i am trying to find out who just joined my page and if the person just join i would like to display that person name onto the site. i just need to know how to find out who just join and i believe i can take it from there Link to comment Share on other sites More sharing options...
niche Posted August 24, 2012 Share Posted August 24, 2012 (edited) Just make sure there's a column in your user table for the datetime they joined and do an ajax call that runs onload that selects that column. EDIT : Or selects on refresh in the case of php Edited August 24, 2012 by niche Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 24, 2012 Author Share Posted August 24, 2012 i dont think you understand what i said richie Link to comment Share on other sites More sharing options...
niche Posted August 24, 2012 Share Posted August 24, 2012 Does your user table have a column that stores a user's join datetime? If not, add one. If so, just display the relevant info or the member that most recently joined when your page loads. Super simple in php. Link to comment Share on other sites More sharing options...
birbal Posted August 24, 2012 Share Posted August 24, 2012 you need to set a column for join time as unix timestamp. and you need to select users with descending order(ORDER BY jointime DESC) on that timestamp column. if you want to get only one last user use LIMIT. 2 Link to comment Share on other sites More sharing options...
niche Posted August 24, 2012 Share Posted August 24, 2012 Good point about LIMIT. Originally, I just ran a fetch array once. That began to slow things down as more users came online. Link to comment Share on other sites More sharing options...
birbal Posted August 24, 2012 Share Posted August 24, 2012 (edited) yes,in any case It is always good not to pull the data which you are not going to use anyway.It will be waste of resource. Edited August 24, 2012 by birbal Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 24, 2012 Author Share Posted August 24, 2012 what i did was do a num row, then i fetch the information by its ID order by descending, which work perfectly find, but imma try it you way because i still want to add more stuff to it and im just messing around with my clients work, since he doesnt need it any time soon hehehehe Link to comment Share on other sites More sharing options...
birbal Posted August 24, 2012 Share Posted August 24, 2012 doing order by in id column also is fine if it is PK autoincremented. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 24, 2012 Share Posted August 24, 2012 The issue with ordering by the ID is that you don't know when they joined. If you had a date column then you can say how long ago they joined, or it will let you only get people who have joined within a certain time. Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 24, 2012 Author Share Posted August 24, 2012 The issue with ordering by the ID is that you don't know when they joined. If you had a date column then you can say how long ago they joined, or it will let you only get people who have joined within a certain time.that sound more interested ok, well im back on the pc, had to take a break so ill use yall suggestions Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 25, 2012 Author Share Posted August 25, 2012 yeah that works, imma have to test it out when i wake up to see if its gonna pick up the ppl who join by each dated Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 26, 2012 Author Share Posted August 26, 2012 so i got it working, by taking part of what you guys said to do and using the date(); function in php, i created a variable for the date(); function then i placed it into a while loop then i echo out the new user name, soo i did $mdy = date('F d Y');the query();if($mdy){while($toshow = mysqli_fetch_array(the query variable here/ result variable however you code)){echo $toshow['column'];}} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now