Forum Moderators: coopster
2: upon logging in register a session variable which contains the user's name. like:
if (mysql_num_rows($result) == 1) //if the number of results equals 1 (eg.: user entered correct details to login)
{
// if they are in the database register some stuff we need across the site
$_SESSION['valid_user'] = $row['username']; // <-----------
$_SESSION['uid'] = $row['uid'];// user id, probably your first column in the user tabel
}
next just do a echo $_SESSION['valid_user'] where you want to display the name of the current logged in user
1: make a column in the message post table containig user id's, this will hold the user's id from the user table, so you can query that table to see who posted it.
>Im ok here
INNER JOIN query would be handy here btw
>OK
2: upon logging in register a session variable which contains the user's name. like:
if (mysql_num_rows($result) == 1) //if the number of results equals 1 (eg.: user entered correct details to login)
{
>what is "mysql_num_rows"?
// if they are in the database register some stuff we need across the site
$_SESSION['valid_user'] = $row['username']; // <-----------
$_SESSION['uid'] = $row['uid'];// user id, probably your first column in the user tabel
}
>which part of above is grabbing the current user from the client side? I assume from the server side there can be many users logged in at the same time....my guess here is its the 'valid_user'?
next just do a echo $_SESSION['valid_user'] where you want to display the name of the current logged in user