Jump to content

Help with Query


Loathorhealer

Recommended Posts

[code] if ($logged_in == 1) {
    echo 'welcome back '.$_SESSION['username'].'';
$query = sprintf("SELECT firstname, lastname FROM users WHERE ("$logged_in == 1")");


$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);[/code]


okay. I get this error

[code]Parse error: syntax error, unexpected T_VARIABLE in /home/.navy/loathor/squaresyndicate.com/welcome.php on line 13[/code]

and I know its becuase of the $logged_in <-- deal. but I need it to display the firstname and the lastname of the person Just logged in. can you help?

Link to comment
https://forums.phpfreaks.com/topic/5732-help-with-query/
Share on other sites

[!--quoteo(post=358109:date=Mar 25 2006, 12:50 AM:name=Loathorhealer)--][div class=\'quotetop\']QUOTE(Loathorhealer @ Mar 25 2006, 12:50 AM) [snapback]358109[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code] if ($logged_in == 1) {
    echo 'welcome back '.$_SESSION['username'].'';
$query = sprintf("SELECT firstname, lastname FROM users WHERE ("$logged_in == 1")");
$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);[/code]
okay. I get this error

[code]Parse error: syntax error, unexpected T_VARIABLE in /home/.navy/loathor/squaresyndicate.com/welcome.php on line 13[/code]

and I know its becuase of the $logged_in <-- deal. but I need it to display the firstname and the lastname of the person Just logged in. can you help?
[/quote]

What is actually stored in the variable $logged_in?
Link to comment
https://forums.phpfreaks.com/topic/5732-help-with-query/#findComment-20643
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.