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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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