Me n My Programming

If Only I Have TIme

Error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

I just finish a simple web site. This site mainly for a survey purpose. Displaying the survey question is easy but the tricky part is the calculation. Beside than total up the value of each answer, I need to do some analysis. Not easy but I manage to crack it out. Use a bit of creativity, try n error and most of wandering in front of my notebook. Looking at the lcd screen hoping an idea pop out and helps me. That is done and really appreciate the think while walking and sleeping. Normal people would just simply think it is something like add or minus operation, but no. It is more than that. With all that I have gone through, I still manage to get this kind of error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

Can you imagine that I spent almost one hour checking 200++ loc to see where I miss the syntax. Most of the forum that I search give feedback about missing a “.”

Here is the code:

$expr = “INSERT INTO tbla (matric, active, reflective, sensing, intuitive, visual, verbal, segmential, global) values(‘$_SESSION[‘matric’]’, ‘$active’, ‘$reflective’, ‘$sensing’, ‘$intuitive’, ‘$visual’, ‘$verbal’, ‘$segmential’, ‘$global’)”;

the solution:

$expr = “INSERT INTO tbla (matric, active, reflective, sensing, intuitive, visual, verbal, segmential, global) values(‘”.$_SESSION[‘matric’].”‘, ‘$active’, ‘$reflective’, ‘$sensing’, ‘$intuitive’, ‘$visual’, ‘$verbal’, ‘$segmential’, ‘$global’)”;

Can you see the different? Sure you can. I took that hole time just to find 10 second works. Hmm…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on July 18, 2008 by in Php and tagged .
%d bloggers like this: