Parse Error Syntax Error Unexpected T_encapsed_and_whitespace Php
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 Us Learn more about Stack Overflow the company Business Learn more about
Unexpected T_encapsed_and_whitespace, Expecting T_string Or T_variable Or T_num_string
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask parse error syntax error unexpected t_encapsed_and_whitespace expecting 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 t_encapsed_and_whitespace wordpress them; it only takes a minute: Sign up PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE [closed] up vote -2 down vote favorite A person gets the error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE from the following code: $query =
Parse Error Syntax Error Unexpected T_encapsed_and_whitespace Expecting Identifier T_string
"SELECT story,video FROM `storycodes` WHERE `code` = '$code"'; php parsing variables share|improve this question asked Feb 7 '13 at 15:00 michael b 79214 closed as too localized by John Conde, SERPRO, N.B., tereško, DaveRandom Apr 26 '13 at 8:17 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the
Unexpected T_constant_encapsed_string
internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. 4 You answered your own question rather quickly –John Conde Feb 7 '13 at 15:01 A person posts on stackoverflow and checks the code to realize that solving this parse error is trivial, even for a non-programmer and all it takes is a bit of reading that doesn't exceed 20 seconds of person's time. –N.B. Feb 7 '13 at 15:05 I posted this to share my knowledge with others, not to ask for help on something I already know the answer for. –michael b Feb 8 '13 at 14:19 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted This error code results from placing the quotes in the wrong order. In this code it says '$code"' when it should be '$code'" The fixed code would look like this: $query = "SELECT story,video FROM `storycodes` WHERE `code` = '$code'"; ^^--here share|improve this answer edited Feb 7 '13 at 15:01 Marc B 274k24234352 answered Feb 7 '13 at 15:00 michael b 79214 it's generally a good idea to put a visual indicator of where you made the change, especially when you're swapping two characters that at a glance are very similar. +1 f
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 syntax error, unexpected t_variable this site About Us Learn more about Stack Overflow the company Business
Unexpected T_string
Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask heredoc in php 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: Sign http://stackoverflow.com/questions/14754199/php-parse-error-syntax-error-unexpected-t-encapsed-and-whitespace 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 or T_VARIABLE http://stackoverflow.com/questions/26887704/parse-error-syntax-error-unexpected-t-encapsed-and-whitespace 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 '14 at 13:10 ronalds 9
(T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VA Hie i want to update my database from the https://teamtreehouse.com/community/-parse-error-syntax-error-unexpected-tencapsedandwhitespace-expecting-identifier-tstring-or-variable-tva form and from this code , i am getting this http://www.sitepoint.com/forums/showthread.php?650057-Parse-error-syntax-error-unexpected-T_ENCAPSED_AND_WHITESPACE-expecting-T_STRING-o error >>>>>> "Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\about.php on line 85" HERE IS LINE 85: $query = "SELECT * FROM $tab_nam WHERE title = $_POST['title'] AND story syntax error = $_POST['story']"; Please help !! // Allow certain file formats //Note: This can be replaced by including a access type if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; parse error syntax $uploadOk = 0; exit(); } else { $uploadOk = 1; echo "Good"; echo ""; } if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { //echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; $servername = "127.0.0.1"; $username = "root"; $password = ""; $dbname = "news_db2"; $tab_nam= "news_tab"; $when=getdate(); $yr=$when["year"]; $mon=$when["month"]; $day=$when["mday"]; $zuva=$day." ".$mon." ".$yr; $conn = new mysqli($servername, $username, $password); // Create database $sql = "CREATE DATABASE IF NOT EXISTS $dbname"; if ($conn->query($sql) === TRUE) { echo "Database created successfully".""; } else { echo "Error creating database: " . $conn->error.""; } // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // sql to create table $sql = "CREATE TABLE IF NOT EXISTS $tab_nam( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, title VARCHAR(150) NOT NULL, story TEXT(30) NOT NULL, reporter VARCHAR(50), img VARCHAR(50), det VARCHAR(50) )"; if ($conn->query(
syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING o The SitePoint Forums have moved. You can now find them here. This forum is now closed to new posts, but you can browse existing content. You can find out more information about the move and how to open a new account (if necessary) here. If you get stuck you can get support by emailing forums@sitepoint.com If this is your first visit, be sure to check out the FAQ 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. SitePoint Sponsor User Tag List Results 1 to 7 of 7 Thread: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING o Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Dec 3, 2009,16:58 #1 william232 View Profile View Forum Posts SitePoint Wizard Join Date Jul 2006 Location New Zealand Posts 1,300 Mentioned 0 Post(s) Tagged 0 Thread(s) Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING o Hi all, I am having a problem with my php code for some reason i am getting this error and i cant find the problem. heres the error message Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Program Files\xampp\htdocs\StickmenStudios\internships\Project1\test.php on line 22 The Php code is PHP Code: include("dbconnect.php");
`$d="SELECT*FROMplayersWHEREpid='$pid'";
echo$d