Jump to content

unexpected T_VARIABLE


Phpfr3ak

Recommended Posts

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;
    }
  }
} ?>

Link to comment
https://forums.phpfreaks.com/topic/216843-unexpected-t_variable/
Share on other sites

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'")) {

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.