473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Parse error: syntax error, unexpected T_VARIABLE

Hi everyone,

I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the offending line, but being amateur, I don't know where. I've tried putting one in several places, to no avail. Clearly, to solve this in a smaller period than a week I need someone with more skill to help out. Heh heh.

The error is:

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in C:\xampplite\htdocs\BraysideSite\Pages\blog.php on line 11

The following is the offending section of code. Line 11 is the "if $_SESSION" line.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include("connection.php");
  3. if $_SESSION['curr_user'] == '';
  4. {
  5. //Redirects to login page below
  6. header('Location: blog.php');
  7. }
  8. ?>
  9.  
If anyone could help me with this, it'd be much appreciated.

Thanks,
Silva
Dec 1 '07 #1
3 6929
Markus
6,050 Expert 4TB
Hi everyone,

I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the offending line, but being amateur, I don't know where. I've tried putting one in several places, to no avail. Clearly, to solve this in a smaller period than a week I need someone with more skill to help out. Heh heh.

The error is:

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in C:\xampplite\htdocs\BraysideSite\Pages\blog.php on line 11

The following is the offending section of code. Line 11 is the "if $_SESSION" line.

<?php
include("connection.php");
if $_SESSION['curr_user'] == '';
{
//Redirects to login page below
header('Location: blog.php');
}
?>

If anyone could help me with this, it'd be much appreciated.

Thanks,
Silva
Your IF statement needs to be wrapped in ( )

i.e
Expand|Select|Wrap|Line Numbers
  1. if ($_SESSION['curr_user'] == '')
  2.  
and you also dont want the semi colon at the end :)
Dec 1 '07 #2
Ahh. I see. I'll try it out.

It works. Thank you very much for your help.
Dec 2 '07 #3
ak1dnar
1,584 Expert 1GB
Please use the [code=xxx] tags provided. You can find it here
posting guidelines
Dec 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ehartwig | last post by:
I recently created a script for user verification, solved my emailing issues, and then re-created the script in order to work well with the new PHP 5 that I installed on my server. After...
2
by: aamer | last post by:
can anyone please help me, im getting a dumb: Parse error: syntax error, unexpected T_VARIABLE in /home/jeddah/public_html/lomar/cart/remove.php on line 5 in the following file, <?php...
4
by: bovanshi | last post by:
got this annoying error I'm completly new to php... and i have no clue what is wrong here, from what i can tell there is nothing rong with this code... but that isn't what the borwser say :P ...
5
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword')...
1
by: mdouble | last post by:
I'm a complete novice with HTML and PHP. Recently I purchased an auto responder that requires me to edit a PHP file during the installation process as per directions provided in a read me file. ...
4
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost",...
5
praclarush
by: praclarush | last post by:
I've just started php, and this is a class assignment, but my question is I’m getting this error PHP Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in...
2
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
3
by: broll911 | last post by:
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me. here is the error. Parse error: syntax error,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.