I am trying to call data from a mysql table (called logins) into a webpage. I have a table with 2 collumns one is called username, and the other is login. In the table, everytime a user logs in, there username goes into the username collumn, and the time goes into login. To make sure that it doesn't overwrite the old time with the newest, it makes a new row everytime a user logs in.
Now, on the webpage, you enter a user id, and it finds the username, and all other info in another table. Then, since this new table that logs login times doesn't log the user's number, I tried to make it query the username that matches the ID.
[B]However, when I call this into the webpage, it only gives me the most recent time someone has logged in.[/B]
This is my code to try to call the info into the table:
PHP:
/******* END DISPLAY INFORMATION ******/
}
}
elseif ( $_POST ) {
if ( $post_userid == NULL ) {
// error empty fields
echo "Error, empty fields. Go <a href=\"admin_users_ip.php\">back</a>";
}
}
It loads the page, but only the most recent sign in time is shown.
My table contains:
techgearfree@tds.net 2005-01-23 21:37:16
techgearfree@tds.net 2005-01-23 21:48:22
techgearfree@tds.net 2005-01-23 21:50:58
techgearfree@tds.net 2005-01-23 22:18:07
techgearfree@tds.net 2005-01-24 18:15:29
techgearfree@tds.net 2005-01-24 18:18:07
techgearfree@tds.net 2005-01-24 18:19:18
techgearfree@tds.net 2005-01-24 18:21:16
techgearfree@tds.net 2005-01-24 18:21:47
techgearfree@tds.net 2005-01-24 18:23:08
and when I try to insert the infomation, it only gives the most recent. This seems like a problem in the way I called it into the page.
PHP:
$query = "SELECT * FROM logins WHERE username = '$user_username'";
$result = mysql_query($query);
while($result3 = mysql_fetch_array($result)) {
$user_login = $result3['login'];
What I tried to do, was user the variable I used earlier in the code, to make it insert every login collumn information that has that username in the other collumn. However, for some reason it only gives the most recent.
Any Ideas?
PS: If I didn't explain this well enough, you can check out
the end of
http://www.phpbuilder.com/board/showthread.php?s=&threadid=10292755
Thanks