![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0
![]() |
What does T_ENCAPSED_AND_WHITESPACE mean?
Hi,
I'm trying to make a simple form that propagates a newsletter's database. Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in line 164 Here's line 164: $query2 = "INSERT INTO `audrey` ( `email`, `name` , `age` , `location`) VALUES ('$_POST['address']' , '$_POST['name']' , '$_POST['age']' , '$_POST['location']');";Other than simply solving my syntax, can someone please tell me what it means? I can't seem to find these terms on php.net. |
|
|
|
|
|
#2 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
'{$_POST['address']}'Would probably be the easiest method..
__________________
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Oct 2005
Location: Downtown Toronto
Posts: 21
Rep Power: 0
![]() |
Thanks guys that helps. Being a bit of a noob, its hard to know where I'm going wrong sometimes and than I delve into a lot of needless research. Those php errors are hard to understnad.
|
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
To be honest with you, unlike C/C++, I rarely look up those PHP thangies. I go where the line number says and can usually see immediately precisely how I've stuck my head where the sun don't shine. The exception is a missing brace. That usually refers you to the end of the file as the location of the error. When you get that one, warm up your brace matcher.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Professional Programmer
|
[PHP]'$_POST[address]'[/PHP]
This works just as well too. Typically for insert queries with a lot of variables I like to stick them all into other variables. [PHP]$address = $_POST['address'];[/PHP] for example. Then use that when you write your query |
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
While it works, it only works because the PHP parser is extremely lenient. It's not valid code - if you turn on warning messages, you'll see PHP grumble about it. The manual's an excellent tool, and generally, what it says, goes.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|