Defibber Posted March 28, 2008 Share Posted March 28, 2008 Ok, I am trying out Dreamweaver and have built my page but I keep getting this error: Parse error: syntax error, unexpected $end in (last line), I have tried trouble shooting and I am unfamiliar with some of the coding techniques that dreamweaver uses. I build the site at www.kearneyfire.org using a text based editor, so I am a little familiar with PHP. Instead of inserting all of the code I am going to insert just the PHP Snippets one chunk at a time. <?php do { ?> <tr> <td><dl> <dt><?php echo $row_rsPublic_ann['title']; ?></dt> <dt><?php echo $row_rsPublic_ann['article']; ?></dt> </dl> <br /> <div align="right"><?php if($row_rsPublic_ann['dwnldID'] == 0) { $pub_ann = "No download available"; } else { $row_rsPublic_ann['path'] = $path; $row_rsPublic_ann['filename'] = $filename; $row_rsPublic_ann['anchor'] = $anchor; $row_rsPublic_ann['descript'] = $descript; $pub_ann = "<a href=\"http://kearneyfire.org/downloads/$path/$filename\">$anchor</a><br>$descript"; } echo "$pub_ann";?> </div></td> </tr> <?php } while ($row_rsPublic_ann = mysql_fetch_assoc($rsPublic_ann)); ?> <?php do { ?> <tr> <td><dl> <dt><?php echo $row_rsPublic_not['title']; ?></dt> <dt><?php echo $row_rsPublic_not['article']; ?></dt> </dl> <br /> <div align="right"> <?php if($row_rsPublic_not['dwnldID'] == 0) {$pub_not = "No download available"; } else { $row_rsPublic_not['path'] = $path; $row_rsPublic_not['filename'] = $filename; $row_rsPublic_not['anchor'] = $anchor; $row_rsPublic_not['descript'] = $descript; $pub_ann = "<a href=\"http://kearneyfire.org/downloads/$path/$filename\">$anchor</a><br>$descript"; } echo "$pub_not"; ?> </div></td> </tr> <?php } while ($row_rsPublic_not = mysql_fetch_assoc($rsPublic_not)); ?> <?php do { ?> <tr> <td><dl> <dt><?php echo $row_rsPublic_art['title']; ?></dt> <dt><?php echo $row_rsPublic_art['article']; ?></dt> </dl> <br /> <div align="right"><?php if($row_rsPublic_art['dwnldID'] == 0) { $pub_art = "No download available"; } else { $row_rsPublic_art['path'] = $path; $row_rsPublic_art['filename'] = $filename; $row_rsPublic_art['anchor'] = $anchor; $row_rsPublic_art['descript'] = $descript; $pub_art = "<a href=\"http://kearneyfire.org/downloads/$path/$filename\">$anchor</a><br>$descript"; } echo "$pub_art";?> </div></td> </tr> <?php } while ($row_rsPublic_art = mysql_fetch_assoc($rsPublic_art)); ?> <?php @readfile('http://www.kearneyfire.org/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none'); ?> Last one: <?php mysql_free_result($rsPublic_ann); mysql_free_result($rsPublic_not); mysql_free_result($rsPublic_art); ?> Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/ Share on other sites More sharing options...
benjaminbeazy Posted March 28, 2008 Share Posted March 28, 2008 is this the entire script? please post the script in it's entirety Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-502844 Share on other sites More sharing options...
Defibber Posted March 28, 2008 Author Share Posted March 28, 2008 This is all of the PHP of the script with the exception of the connection and queries (I did not create any of that, it was all dreamweaver). I can post the entire thing but I was afraid it would be too lengthy. If you still need the whole thing I can post it all later this morning/early afternoon after I get my laptop up and running at work. Thanks for the look so far, benjaminbeazy. Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503004 Share on other sites More sharing options...
wildteen88 Posted March 28, 2008 Share Posted March 28, 2008 This is the problem with letting Dreamweaver take control. I have tested the provided code snippets and none of them return any syntax errors. I assumed the errors was at the following address in the following code, but that returns an image <?php @readfile('http://www.kearneyfire.org/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none'); ?> Are you sure you got the right page. The error should display the full path to script which is causing the error. Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503033 Share on other sites More sharing options...
conker87 Posted March 28, 2008 Share Posted March 28, 2008 The unexpected $end points to a missing } somewhere I'd say, maybe a missing quote or semi-colon. Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503045 Share on other sites More sharing options...
Defibber Posted March 28, 2008 Author Share Posted March 28, 2008 This is the whole thing. As far as the error, it always refers to the last line of the code no matter what I do with the empty lines. If I have posted something that is crucially private please let me know. Like I said I have a base knowledge of PHP and I am a complete newbie at DW8. Thanks again. <?php require_once('Connections/KFD_site.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $maxRows_rsPublic_ann = 3; $pageNum_rsPublic_ann = 0; if (isset($_GET['pageNum_rsPublic_ann'])) { $pageNum_rsPublic_ann = $_GET['pageNum_rsPublic_ann']; } $startRow_rsPublic_ann = $pageNum_rsPublic_ann * $maxRows_rsPublic_ann; mysql_select_db($database_KFD_site, $KFD_site); $query_rsPublic_ann = "SELECT articles.articleID, articles.type, articles.`date`, articles.status, articles.title, articles.article, articles.dwnldID, downloads.dwnldID, downloads.`path`, downloads.filename, downloads.anchor, downloads.descript FROM articles, downloads WHERE (articles.dwnldID = downloads.dwnldID) AND articles.type = 2 AND articles.status = 'active'"; $query_limit_rsPublic_ann = sprintf("%s LIMIT %d, %d", $query_rsPublic_ann, $startRow_rsPublic_ann, $maxRows_rsPublic_ann); $rsPublic_ann = mysql_query($query_limit_rsPublic_ann, $KFD_site) or die(mysql_error()); $row_rsPublic_ann = mysql_fetch_assoc($rsPublic_ann); if (isset($_GET['totalRows_rsPublic_ann'])) { $totalRows_rsPublic_ann = $_GET['totalRows_rsPublic_ann']; } else { $all_rsPublic_ann = mysql_query($query_rsPublic_ann); $totalRows_rsPublic_ann = mysql_num_rows($all_rsPublic_ann); } $totalPages_rsPublic_ann = ceil($totalRows_rsPublic_ann/$maxRows_rsPublic_ann)-1; $maxRows_rsPublic_not = 3; $pageNum_rsPublic_not = 0; if (isset($_GET['pageNum_rsPublic_not'])) { $pageNum_rsPublic_not = $_GET['pageNum_rsPublic_not']; } $startRow_rsPublic_not = $pageNum_rsPublic_not * $maxRows_rsPublic_not; mysql_select_db($database_KFD_site, $KFD_site); $query_rsPublic_not = "SELECT articles.articleID, articles.type, articles.`date`, articles.status, articles.title, articles.article, articles.dwnldID, downloads.dwnldID, downloads.`path`, downloads.filename, downloads.anchor, downloads.descript FROM articles, downloads WHERE (articles.dwnldID = downloads.dwnldID) AND articles.type = 3 AND articles.status = 'active'"; $query_limit_rsPublic_not = sprintf("%s LIMIT %d, %d", $query_rsPublic_not, $startRow_rsPublic_not, $maxRows_rsPublic_not); $rsPublic_not = mysql_query($query_limit_rsPublic_not, $KFD_site) or die(mysql_error()); $row_rsPublic_not = mysql_fetch_assoc($rsPublic_not); if (isset($_GET['totalRows_rsPublic_not'])) { $totalRows_rsPublic_not = $_GET['totalRows_rsPublic_not']; } else { $all_rsPublic_not = mysql_query($query_rsPublic_not); $totalRows_rsPublic_not = mysql_num_rows($all_rsPublic_not); } $totalPages_rsPublic_not = ceil($totalRows_rsPublic_not/$maxRows_rsPublic_not)-1; $maxRows_rsPublic_art = 3; $pageNum_rsPublic_art = 0; if (isset($_GET['pageNum_rsPublic_art'])) { $pageNum_rsPublic_art = $_GET['pageNum_rsPublic_art']; } $startRow_rsPublic_art = $pageNum_rsPublic_art * $maxRows_rsPublic_art; mysql_select_db($database_KFD_site, $KFD_site); $query_rsPublic_art = "SELECT articles.articleID, articles.type, articles.`date`, articles.status, articles.title, articles.article, articles.dwnldID, downloads.dwnldID, downloads.`path`, downloads.filename, downloads.anchor, downloads.descript FROM articles LEFT JOIN downloads ON articles.dwnldID = downloads.dwnldID WHERE articles.type = 1 AND articles.status = 'active'"; $query_limit_rsPublic_art = sprintf("%s LIMIT %d, %d", $query_rsPublic_art, $startRow_rsPublic_art, $maxRows_rsPublic_art); $rsPublic_art = mysql_query($query_limit_rsPublic_art, $KFD_site) or die(mysql_error()); $row_rsPublic_art = mysql_fetch_assoc($rsPublic_art); if (isset($_GET['totalRows_rsPublic_art'])) { $totalRows_rsPublic_art = $_GET['totalRows_rsPublic_art']; } else { $all_rsPublic_art = mysql_query($query_rsPublic_art); $totalRows_rsPublic_art = mysql_num_rows($all_rsPublic_art); } $totalPages_rsPublic_art = ceil($totalRows_rsPublic_art/$maxRows_rsPublic_art)-1; ?><!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"><!-- InstanceBegin template="/Templates/kfd_public_home.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Untitled Document</title> <!-- InstanceEndEditable --><!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <link href="theme/kfd.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="100%" border="0"> <tr> <td class="kfd_banner"> </td> </tr> <tr> <td><table width="100%" border="0"> <tr> <td class="greeting_l"><? echo date("F j Y");?></td> <td class="greeting_c"><?php if ($_SESSION[username] != ""){ $greeting = "Welcomeback $_SESSION[username]"; echo "$greeting"; ?></td> <td class="greeting_r"><? echo date("H:i");?>Hrs</td> </tr> </table></td> </tr> <tr> <td> <div><!-- InstanceBeginEditable name="EditRegion4" --> <div class="sectionHeading">Welcome to KearneyFire.org </div> <!-- InstanceEndEditable --></div> </td> </tr> <tr class="contentRow"> <td> <table width="100%" border="0"> <tr> <td align="center" valign="top" class="sidebar_17_5"><table width="100%" border="0"> <tr> <td class="nav_header">Site Navigation </td> </tr> <tr> <td class="nav_links"><a href="index.php">Home</a><br /> </td> </tr> <tr> <td><!-- InstanceBeginEditable name="menu_nav" --> <div align="center"> </div> <!-- InstanceEndEditable --></td> </tr> <tr> <td class="nav_header">Registered Users </td> </tr> <tr> <td class="nav_links"><a href="login.php">Login Page </a></td> </tr> </table></td> <td class="content_82_5"> <div align="center" class="content_100"> <table width="100%" border="0"> <tr> <td width="78%" class="content_78"><!-- InstanceBeginEditable name="main_content_78" --> <div align="left"> <table width="100%" border="0"> <tr> <td class="sec_header">Public Announcements </td> </tr> <?php do { ?> <tr> <td><dl> <dt><?php echo $row_rsPublic_ann['title']; ?></dt> <dt><?php echo $row_rsPublic_ann['article']; ?></dt> </dl> <br /> <div align="right"><?php if($row_rsPublic_ann['dwnldID'] == 0) { $pub_ann = "No download available"; } else { $row_rsPublic_ann['path'] = $path; $row_rsPublic_ann['filename'] = $filename; $row_rsPublic_ann['anchor'] = $anchor; $row_rsPublic_ann['descript'] = $descript; $pub_ann = "<a href=\"http://kearneyfire.org/downloads/$path/$filename\">$anchor</a><br>$descript"; } echo "$pub_ann";?> </div></td> </tr> <?php } while ($row_rsPublic_ann = mysql_fetch_assoc($rsPublic_ann)); ?> <tr> <td class="sec_header">Public Notices </td> </tr> <?php do { ?> <tr> <td><dl> <dt><?php echo $row_rsPublic_not['title']; ?></dt> <dt><?php echo $row_rsPublic_not['article']; ?></dt> </dl> <br /> <div align="right"> <?php if($row_rsPublic_not['dwnldID'] == 0) {$pub_not = "No download available";} else { $row_rsPublic_not['path'] = $path; $row_rsPublic_not['filename'] = $filename; $row_rsPublic_not['anchor'] = $anchor; $row_rsPublic_not['descript'] = $descript; $pub_ann = "<a href=\"http://kearneyfire.org/downloads/$path/$filename\">$anchor</a><br>$descript";} echo "$pub_not";?> </div></td> </tr> <?php } while ($row_rsPublic_not = mysql_fetch_assoc($rsPublic_not)); ?> <tr> <td class="sec_header">Articles</td> </tr> <?php do { ?> <tr> <td><dl> <dt><?php echo $row_rsPublic_art['title']; ?></dt> <dt><?php echo $row_rsPublic_art['article']; ?></dt> </dl> <br /> <div align="right"><?php if($row_rsPublic_art['dwnldID'] == 0) {$pub_art = "No download available";} else { $row_rsPublic_art['path'] = $path; $row_rsPublic_art['filename'] = $filename; $row_rsPublic_art['anchor'] = $anchor; $row_rsPublic_art['descript'] = $descript; $pub_art = "<a href=\"http://kearneyfire.org/downloads/$path/$filename\">$anchor</a><br>$descript";} echo "$pub_art";?> </div></td> </tr> <?php } while ($row_rsPublic_art = mysql_fetch_assoc($rsPublic_art)); ?> <tr> <td class="sec_header">Call Log </td> </tr> <tr> <td> </td> </tr> <tr> <td class="sec_header">Current Conditions </td> </tr> <tr> <td><table width="100%" border="0"> <tr> <td>Air Quality by MARC.org<br /> <img src="http://www.marc.org/airquality/alert.gif" alt="Mid-America Regional Council: Air Quality" width="300" height="52" border="0" /></td> <td>National Weather Service Radar<br /> <a href="http://forecast.weather.gov/MapClick.php?CityName=Liberty&state=MO&site=EAX" target="_blank"><img src="http://radar.weather.gov/Thumbs/EAX_Thumb.gif" alt="National Weather Service Radar" /></a></td> </tr> </table></td> </tr> </table> </div> <!-- InstanceEndEditable --></td> <td width="22%" class="sidebar_22"><!-- InstanceBeginEditable name="right_sidebar" --> <div align="left"> <table width="100%" border="0"> <tr> <td class="nav_header">Calendar</td> </tr> <tr align="center" valign="top"> <td><iframe src="http://www.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23FFFFFF&src=calendar%40kearneyfire.org&color=%23A32929&ctz=America%2FChicago" style=" border-width:0 " width="100%" height="300" frameborder="0" scrolling="yes"></iframe></td> </tr> <tr> <td class="nav_header">Photo Gallery </td> </tr> <tr align="center"> <td><?php @readfile('http://www.kearneyfire.org/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none'); ?></td> </tr> <tr> <td class="nav_header">Members of: </td> </tr> <tr align="center" valign="top"> <td><img src="images/entities/marc.gif" width="135" height="50" alt="MARC" /><br />Mid-America Regional Council<br /><hr /><img src="images/entities/ffam.gif" width="115" height="104" alt="FFAM" /><br />FFAM<br /><hr /><br /><img src="images/entities/ichief.gif" width="135" height="141" alt="I-Chiefs" /><br />Int'l Chiefs<br /><hr /><br /><img src="images/entities/iaff.gif" width="135" height="133" alt="IAFF_42" /><br />IAFF Local 42</td> </tr> </table> </div> <!-- InstanceEndEditable --></td> </tr> </table> </div> </td> </tr> </table></td> </tr> <tr> <td class="footer">201 E. 6th St / P.O. Box 341<br /> Kearney, Missouri. 64060</td> </tr> </table> <!-- InstanceBeginEditable name="EditRegion5" --> <tr> <td> </td> </tr> <!-- InstanceEndEditable --> <tr> <td> </td> </tr> <tr> <td> </td> </tr> </body><!-- InstanceEnd --></html> <?php mysql_free_result($rsPublic_ann); mysql_free_result($rsPublic_not); mysql_free_result($rsPublic_art); ?> Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503349 Share on other sites More sharing options...
BlueSkyIS Posted March 28, 2008 Share Posted March 28, 2008 it appears that this if is never closed: <?php if ($_SESSION[username] != ""){ $greeting = "Welcomeback $_SESSION[username]"; echo "$greeting"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503373 Share on other sites More sharing options...
timmy0320 Posted March 28, 2008 Share Posted March 28, 2008 Yeah I seen what BlueSky seen also. For future reference $end error will *always* display the last line of the code. It usually means you didn't close } something out. Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503379 Share on other sites More sharing options...
Defibber Posted March 28, 2008 Author Share Posted March 28, 2008 OK, that fixed it!! The error was in one of my templates so it was grayed out and I didn't recognize it as a PHP section. Thanks for the help! (should I remove the majority of the code for security?) Thanks again, I can now lay off the IBprofen. Quote Link to comment https://forums.phpfreaks.com/topic/98270-dreamweaver-8-trouble-parse-error-syntax-error-unexpected-end-in/#findComment-503459 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.