PDA

View Full Version : PHP PHP Error I can't fix



dreamerp
September 14th, 2008, 05:29 PM
Hello, I keep getting the following error and I can't figure out what the issue is.

Parse error: syntax error, unexpected T_STRING in /home/pjcenter/public_html/test/addnewpage.php on line 69

Here is the PHP code.


<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

if ($_GET["a"] == "go"){
mysql_connect ("host","user","pass");
mysql_select_db("db");
$selectp = mysql_query("SELECT * FROM products");
while ($row = mysql_fetch_array($selectp)){
$productname = $row["productname"];
$keywords = $row["keywords"];
$description = $row["description"];
$asin = $row["asin"];

$qfname=str_replace(" ","-",$productname);
$qfname=str_replace("?","",$qfname);

//open file
$fp = fopen("$qfname.html","wb");
$code = "
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>".$productname."</title>
<meta http-equiv=\"Expires\" content=\"-1\">
<meta http-equiv=\"Cache-Control\" content=\"no-cache\">
<meta name=\"description\" content=\"".$description."\">
<meta name=\"keywords\" content=\"".$keywords."\">
</head>
<body>
<p>
<?php include 'header.php'; ?></p>
<table width=\"968\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<!--DWLayoutTable-->
<tr>
<td width=\"160\" valign=\"top\"><?php include 'leftnavigation.php'; ?></td>
<td width=\"630\" valign=\"top\" bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">
<tr>
<td><img src=\"library/spacer.gif\" width=\"10\" height=\"1\" class=\"imagefloat2\" /><img src=\"library/spacer.gif\" width=\"10\" height=\"1\" class=\"imagefloat2\" /><?php ItemLookup('$asin'); ?></td>
</tr>
</table>
<p class=\"pagecontent\">&nbsp;</p></td>
<td width=\"160\" valign=\"top\"><?php include 'rightbar.php'; ?></td>
</tr>
</table>
<center>
</center>
<?php include 'footer.php'; ?>
</body>
</html>";

fwrite($fp,$code);
echo "done";
fclose($fp);

}

}
?>

Line 69 is the blank space before the fwrite($fp,$code); I was looking for any quotes that weren't closed, but didn't find anything.

Can someone please help?

kdd
September 14th, 2008, 09:51 PM
Double quotes expands variables. Try using single quotes. Like
$code = '<div id="xyz">hi</div>'; It's a bit hard to trace, because you've got so many (double) quotes, and slashes and stuff...

dreamerp
September 14th, 2008, 10:44 PM
Hey,

there wasnt an issue with my code, but the GoFTP program I had just installed placed code onto the page that said i used the program.. i guess thats what you get with free ftp programs. anyways, it messed stuff up. so, i wouldn't recommend GoFTP

thanks

tfg
September 15th, 2008, 07:06 AM
filezilla (http://www.filezilla-project.org/) free ftp ftw.