Phpfr3ak Posted October 26, 2010 Share Posted October 26, 2010 does anyone see why i get an unexpected T_VARIABLE here? Ive varied the code from something i had that was working so i don't see why it fails to work, any help would be great thanks. <?php require_once('_includes/db_connection.php'); if ($result = mysql_query('SELECT Banned FROM users WHERE username = '$username'')) { if (mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); if ($row['Banned'] != No) { echo "You are banned"; exit; } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/216843-unexpected-t_variable/ Share on other sites More sharing options...
trq Posted October 26, 2010 Share Posted October 26, 2010 if ($result = mysql_query("SELECT Banned FROM users WHERE username = '$username'")) { Quote Link to comment https://forums.phpfreaks.com/topic/216843-unexpected-t_variable/#findComment-1126489 Share on other sites More sharing options...
Pikachu2000 Posted October 26, 2010 Share Posted October 26, 2010 You left the quote open on the line with your query string. Notice how the syntax highlighting colors change at that point? And while you're editing anyhow, you might as well change the quoting on the query string to double quotes, or the variable $username won't be interpolated . . . if ($result = mysql_query("SELECT Banned FROM users WHERE username = '$username'")) { Quote Link to comment https://forums.phpfreaks.com/topic/216843-unexpected-t_variable/#findComment-1126491 Share on other sites More sharing options...
Phpfr3ak Posted October 26, 2010 Author Share Posted October 26, 2010 Thanks guys! Once again on the ball thorpe, appreciate all the help you have provided over the last few days. Quote Link to comment https://forums.phpfreaks.com/topic/216843-unexpected-t_variable/#findComment-1126494 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.