fishfin Posted November 8, 2007 Share Posted November 8, 2007 What dose this error message mean? ??? Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\AppServ\www\site\index.php on line 23 Link to comment https://forums.phpfreaks.com/topic/76478-what-does-this-error-mean/ Share on other sites More sharing options...
~n[EO]n~ Posted November 8, 2007 Share Posted November 8, 2007 There is a PARSE error, PHP is expecting Variable, String or Number and you have Whitespace in your code, Post your code... Link to comment https://forums.phpfreaks.com/topic/76478-what-does-this-error-mean/#findComment-387342 Share on other sites More sharing options...
fishfin Posted November 8, 2007 Author Share Posted November 8, 2007 OK, here it is: <?php $page_number = $_GET['page']; $connect = mysql_connect("localhost","root","pass"); if (!$connect) { die('Error connecting to database. Mysql error: ' . mysql_error()); } mysql_select_db("database", $connect); $outcome = mysql_query("SELECT * FROM pages WHERE id = '$page_number'"); while($result = mysql_fetch_array($outcome)) { echo <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>My Site - . $result['title'] . </title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div class="all"> <div class="top"> <br /> MySite.com </div> <div class="links"> <a class="link" href="#">Home</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Guangxi</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Nanning</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Beihai</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Guilin</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Liuzhuo</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Other Cities</a> <img src="line.bmp" alt="" /> <a class="link" href="#">About Me</a> <img src="line.bmp" alt=""/> <a class="link" href="#">Contact Me</a> </div> <div class="body"> <div class="head1"> . $result['up'] . </div> . $result['content'] . </div> <div class="links"> © 2007 Caleb Hansen </div> </div> </body> </html> END; } mysql_close($connect); ?> Link to comment https://forums.phpfreaks.com/topic/76478-what-does-this-error-mean/#findComment-387345 Share on other sites More sharing options...
~n[EO]n~ Posted November 8, 2007 Share Posted November 8, 2007 Your code should be like this , you need to check out some tutorials (there are lots in www.phpfreaks.com) <?php $page_number = $_GET['page']; //connection $connect = mysql_connect("localhost","root","pass"); if (!$connect) { die('Error connecting to database. Mysql error: ' . mysql_error()); } mysql_select_db("database", $connect); //output $outcome = mysql_query("SELECT * FROM pages WHERE id = '$page_number'"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>My Site </title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div class="all"> <div class="top"> <br /> MySite.com </div> <div class="links"> <a class="link" href="#">Home</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Guangxi</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Nanning</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Beihai</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Guilin</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Liuzhuo</a> <img src="line.bmp" alt="" /> <a class="link" href="#">Other Cities</a> <img src="line.bmp" alt="" /> <a class="link" href="#">About Me</a> <img src="line.bmp" alt=""/> <a class="link" href="#">Contact Me</a> </div> <?php while($result = mysql_fetch_array($outcome)) { echo "What to echo here ";?> <div class="body"> <div class="head1"><?php echo $result['up']?></div> <?php echo $result['content'] ?> </div> <? } ?> <div class="links"> © 2007 Caleb Hansen </div> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/76478-what-does-this-error-mean/#findComment-387350 Share on other sites More sharing options...
fishfin Posted November 8, 2007 Author Share Posted November 8, 2007 Thanks! I didn't realize that after you put the '?>' tag you could call back a variable later on in the code from within the original '<?php ... ?>' Link to comment https://forums.phpfreaks.com/topic/76478-what-does-this-error-mean/#findComment-387442 Share on other sites More sharing options...
~n[EO]n~ Posted November 8, 2007 Share Posted November 8, 2007 That's why I told you to see some tutorials . You can learn so many things. Link to comment https://forums.phpfreaks.com/topic/76478-what-does-this-error-mean/#findComment-387445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.