Syntax error, need help
Posted: Thu Aug 12, 2004 10:56 am
I have a page that is supposed to show different things depending on the level the user's account has. But i keep getting this error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
this is my script:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
this is my script:
Code: Select all
<?php
$checkcookie = $_COOKIE['terrastormlogin'];
if (isset($checkcookie))
{
$loggedin = '1';
global $loggedin;
global $user;
require('db_info.php');
mysql_connect("$host", "$username", "$password") or die(mysql_error());
mysql_select_db("$database") or die(mysql_error());
$checklevel = mysql_query("SELECT * from accounts WHERE username=$user") or die(mysql_error());
while ($fetch=mysql_fetch_array($checklevel))
{
$level=$fetch['level'];
$user=$fetch['username'];
if ($level = 0)
{
$maincontent = "Normal User";
}
else if ($level = 1)
{
$maincontent = "Moderator";
}
else if ($level = 2)
{
$maincontent = "Low Level Admin";
}
else if ($level = 3)
{
$maincontent = "Admin";
}
else if ($level = 4)
{
$maincontent = "Developer";
}
else if ($level = 5)
{
$maincontent = "God!";
}
}
}
else if (isset($checkcookie))
{
$loggedin = "0";
global $loggedin;
$maincontent = "";
$maincontent .= "Cookie Not Set";
}
?>