Page 1 of 1

Parse error: parse error, unexpected T_VARIABLE in

Posted: Fri Aug 19, 2005 4:20 am
by ianhull
Parse error: parse error, unexpected T_VARIABLE in C:\Xeneo\office\index.php on line 20

If anyone can please help with this error it would be greatly appreciated.

Thanks in advance.

Code: Select all

<?php 
include ("connect.php");
$sql = "SELECT companyname, firstname, lastname, email, password, ulevel FROM users WHERE firstname='$_REQUEST[fname]' AND password='$_REQUEST[pwd]'";

$result = mysql_query($sql)
 or die ("Couldn't select $_REQUEST[fname]");

echo "

\n";

//-------------get each event type ------

while ($line = mysql_fetch_array($result))    
      {
      extract($line);      // extracts all line into variables with same name as fields 
      }
echo "\n";
$usrlevel = $ulevel 
$adminlevel = "1"; 
if ($usrlevel == $adminlevel){ 
    echo include_once("admincontent.php"); 
} else { 
    echo include_once("usercontent.php"); 
}
?>

Posted: Fri Aug 19, 2005 4:23 am
by sticksys
you forget to close the varbiel with ";"

here is the fixed code:

Code: Select all

<?php
include ("connect.php");
$sql = "SELECT companyname, firstname, lastname, email, password, ulevel FROM users WHERE firstname='$_REQUEST[fname]' AND password='$_REQUEST[pwd]'";

$result = mysql_query($sql);
or die ("Couldn't select $_REQUEST[fname]");

echo "

\n";

//-------------get each event type ------

while ($line = mysql_fetch_array($result))    
      {
      extract($line);      // extracts all line into variables with same name as fields
      }
echo "\n";
$usrlevel = $ulevel;
$adminlevel = "1";
if ($usrlevel == $adminlevel){
    echo include_once("admincontent.php");
} else {
    echo include_once("usercontent.php");
}

Posted: Fri Aug 19, 2005 4:24 am
by phpdevuk
you were missing a ; after the $result=mysql_query($sql) see below

Code: Select all

<?php 
include ("connect.php"); 
$sql = "SELECT companyname, firstname, lastname, email, password, ulevel FROM users WHERE firstname='$_REQUEST[fname]' AND password='$_REQUEST[pwd]'"; 

// the line below didn't have a ;

$result = mysql_query($sql);
or die ("Couldn't select $_REQUEST[fname]"); 

echo " 

\n"; 

//-------------get each event type ------ 

while ($line = mysql_fetch_array($result))     
      { 
      extract($line);      // extracts all line into variables with same name as fields 
      } 
echo "\n"; 
$usrlevel = $ulevel 
$adminlevel = "1"; 
if ($usrlevel == $adminlevel){ 
    echo include_once("admincontent.php"); 
} else { 
    echo include_once("usercontent.php"); 
} 
?>

Posted: Fri Aug 19, 2005 4:26 am
by sticksys
not only there,

$usrlevel = $ulevel ..



look one message up to yours :D

Posted: Fri Aug 19, 2005 4:28 am
by ianhull
Thanks for the help.

Unfortunatly it did not work.

I have a syntax error on line 20 which is

Code: Select all

$adminlevel = "1";
Any more help wil be greatly appreciated.

Code: Select all

<?php 
include ("connect.php"); 
$sql = "SELECT companyname, firstname, lastname, email, password, ulevel FROM users WHERE firstname='$_REQUEST[fname]' AND password='$_REQUEST[pwd]'"; 

$result = mysql_query($sql) 
or die ("Couldn't select $_REQUEST[fname]"); 

echo " 

\n"; 

//-------------get each event type ------ 

while ($line = mysql_fetch_array($result))     
      { 
      extract($line);      // extracts all line into variables with same name as fields 
      } 
echo "\n"; 
$usrlevel = $ulevel 
$adminlevel = "1"; 
if ($usrlevel == $adminlevel){ 
    echo include_once("admincontent.php"); 
} else { 
    echo include_once("usercontent.php"); 
} 
?>

Posted: Fri Aug 19, 2005 4:30 am
by korto
still missing a ; at line 19

Posted: Fri Aug 19, 2005 4:31 am
by ianhull
Thanks Guys.

:D

Posted: Fri Aug 19, 2005 6:05 am
by raghavan20
I never felt PHP to be a good interpreter.
it does not recognize missing brace and many others that are common in other languages.
if you make an error at line 55 it might show some error at 100 or 14 something like it. I usually have to recollect the last few steps or just undo wot I have done :evil:
not so rigid!!! no user friendly messages!!!

Re: Parse error: parse error, unexpected T_VARIABLE in

Posted: Sun Aug 21, 2005 8:49 pm
by harrisonad
ianhull wrote:Parse error: parse error, unexpected T_VARIABLE in C:\Xeneo\office\index.php on line 20

Code: Select all

$usrlevel = $ulevel // <- missing semicolon