Heres what I got. My sessions work properly...but when I do this query it doesnt bring back anything from my database. what I want it to do is bring back the firstname and the lasname of the logged in user.
PHP Code:
[size="2"] if ($logged_in == 1) {
echo 'welcome back '.$_SESSION['username'].'';
$query = sprintf("SELECT firstname, lastname FROM users WHERE '.$_SESSION['username'].'");
$result = mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
while ($row = mysql_fetch_field($result)) {
echo $row['firstname'];
echo $row['lastname'];
}
mysql_free_result($result);[/size]