Parse Error Syntax Error Unexpected T_encapsed_and_whitespace
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string Us Learn more about Stack Overflow the company Business Learn more about hiring t_encapsed_and_whitespace wordpress developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the syntax error unexpected t_encapsed_and_whitespace expecting Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected '' parse error syntax error unexpected t_encapsed_and_whitespace expecting identifier t_string (T_ENCAPSED_AND_WHITESPACE) [duplicate] up vote 3 down vote favorite 1 This question already has an answer here: Reference - What does this error mean in PHP? 29 answers Full Error: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) It says that the error is on line 12. Here is what I have there: $introduction="INSERT INTO Introduction (Title, Description) VALUES
Unexpected T_constant_encapsed_string
('$_POST[introtitle]','$_POST['introdescription']')"; Any help would be greatly appreciated! php mysql share|improve this question edited Jul 25 '13 at 20:49 Erman Belegu 2,7471431 asked Jul 25 '13 at 20:44 user1804933 1041210 marked as duplicate by Michael Berkowski, bwoebi, Gordon Jul 25 '13 at 20:48 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. 1 See stackoverflow.com/questions/12769982/… It's the quotes in $_POST['introdescription'] –Michael Berkowski Jul 25 '13 at 20:45 1 Not onto the more serious issue - this is highly vulnerable to SQL injection. You ought to be using parameterized queries via PDO or MySQLi. Read over this question and its answers. –Michael Berkowski Jul 25 '13 at 20:45 You need to read up on SQL injection bugs and how to properly escape data before you write any more SQL code. –tadman Jul 25 '13 at 20:48 add a comment| 1 Answer 1 active oldest votes up vote 6 down vote accepted You have extra single quotes : $introduction="INSERT INTO Introduction (Title, Description) VALUES ('$_POST[introtitle]','$_POST[introdescription]')"; share|improve this answer edited Jan 29 '15 at 6:12 answered Jul 25 '13 at 20
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Syntax Error, Unexpected T_variable
of this site About Us Learn more about Stack Overflow the company unexpected t_string Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges parse error: syntax error, unexpected end of file Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: http://stackoverflow.com/questions/17868387/parse-error-syntax-error-unexpected-t-encapsed-and-whitespace Sign up Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE up vote 1 down vote favorite I might have a syntax error or something but I don't see nothing. On the echo line, I have the error : [error] [client] PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING http://stackoverflow.com/questions/26887704/parse-error-syntax-error-unexpected-t-encapsed-and-whitespace or T_VARIABLE or T_NUM_STRING in /var/www/slimtest/views/nuevo.php on line 89 Maybe you can help, because I don't see the error D"= php html compiler-errors syntax-error whitespace share|improve this question edited Nov 12 '14 at 13:15 Machavity 18.2k133259 asked Nov 12 '14 at 13:04 Juan 83 add a comment| 4 Answers 4 active oldest votes up vote 0 down vote accepted This should work: share|improve this answer answered Nov 12 '14 at 13:11 Deepak 1,591516 Thanks, worked perfect. –Juan Nov 12 '14 at 14:10 add a comment| up vote 0 down vote When using array variables inside of strings it's usually better to use the complex syntax: echo "(''.'
)"; Alternatively you can remove the quotes in the array key: echo "(''.'
)"; PHP String Variable Parsing share|improve this answer answered Nov 12 '14 at 13:10 Jim 17.5k32859 add a comment| up vote 0 down vote Try changing echo line to this: echo ''; share|improve this answer answered Nov 12 '
T_STRING If this is your first visit, be sure to check out the FAQ http://board.phpbuilder.com/showthread.php?10365588-RESOLVED-Parse-error-syntax-error-unexpected-T_ENCAPSED_AND_WHITESPACE-expecting-T_STRING by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 4 of 4 Thread: [RESOLVED] Parse error: syntax error, unexpected syntax error T_ENCAPSED_AND_WHITESPACE, expecting T_STRING Tweet Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 05-20-2009,05:20 PM #1 chaseab View Profile View Forum Posts Junior Member Join Date May 2009 Posts 15 [RESOLVED] Parse syntax error unexpected error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING Here is the full error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING on line 13 Line 13 States: PHP Code: $search=mysql_query("SELECT*FROMsearchengineWHEREpageurl='$_POST['url']'");
The code is for a search engine to check if the url exists and if it dosen't add it to the data base The whole code is PHP Code:
$mysql_host="host";
$mysql_database="database";
$mysql_user="user";
$mysql_password="pass";
mysql_connect($mysql_host,$m