co.ador Posted January 22, 2010 Share Posted January 22, 2010 I have a similar issue with a pagination script it just that it has a parse error and I can not see it, but I think the logic is ok. echo "<a href='{$_SERVER['PHP_SELF']}?currentpage=1&name=". $_POST['name']. '&zipcode=' $_POST['zipcode'] .'&state=' $_POST['state'] . '&food_types= ' $_POST['frmSearch']['food_types'][0]. '&offerings=' $_POST['frmSearch']['offerings'][0]"' ><<</a> "; The whole script above is one line and that's line 513 and the browsers display an parse error as: Parse error: parse error, expecting `','' or `';'' in C:\wamp\www\nyhungry\indexpagination.php on line 513 it says it is missing a '," or ';" I don't know where should it go. I have tried after ['offereings'][0]";' but it won't work. That's the only place my limited eyes can suspect of. help Link to comment https://forums.phpfreaks.com/topic/189439-parse-error-help/ Share on other sites More sharing options...
Mchl Posted January 22, 2010 Share Posted January 22, 2010 You're missing a few .s here and there. echo "<a href='{$_SERVER['PHP_SELF']}?currentpage=1&name=". $_POST['name']. '&zipcode=' . $_POST['zipcode'] .'&state=' . $_POST['state'] . '&food_types= ' . $_POST['frmSearch']['food_types'][0]. '&offerings=' . $_POST['frmSearch']['offerings'][0]."' ><<</a> "; Link to comment https://forums.phpfreaks.com/topic/189439-parse-error-help/#findComment-999952 Share on other sites More sharing options...
co.ador Posted January 22, 2010 Author Share Posted January 22, 2010 Now i don't know if the logic is good now, because it's not working properly the pagination links Help. <?php if ( trim($_POST['name']) == '' & $_POST['zipcode'] =='' & $_POST['state'] =='' & $_POST['frmSearch']['food_types'][0]=='' & $_POST['frmSearch']['offerings'][0]=='') //$strZipCode == '' && $strState == '' $arrFoodTypes =='' && $arrOfferings == '') { echo '<div id="tresuno">'; var_dump($_POST); echo'<p class="tremendi">No results for your match please try again!</p> <div id="tresdo"> <a href="index3.php"><< Go Back</a> </div>';} else { var_dump($_POST); $strName = isset($_POST['name'])?mysql_real_escape_string($_POST['name']):''; $strZipCode = isset($_POST['zipcode'])?mysql_real_escape_string($_POST['zipcode']):''; $strState = isset($_POST['state'])?mysql_real_escape_string($_POST['state']):''; $arrFoodTypes = isset($_POST['frmSearch']['food_types'])?$_POST['frmSearch']['food_types']:array(); $arrOfferings = isset($_POST['frmSearch']['offerings'])?$_POST['frmSearch']['offerings']:array(); <div id=pagination> <?php // //$arr= $arr= array( 'name'=>$strName,'zipcode'=>$strZipCode, 'state'=> $strState,'food_types'=> $arrFoodTypes, 'offerings'=>$arrOfferings); //$query3 = http_build_query($arr); /****** build the pagination links ******/ // range of num links to show $range = 4; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo "<a href='{$_SERVER['PHP_SELF']}?currentpage=1&name=". $_POST['name']. '&zipcode=' . $_POST['zipcode'] .'&state=' . $_POST['state'] . '&food_types= ' . $_POST['frmSearch']['food_types'][0]. '&offerings=' . $_POST['frmSearch']['offerings'][0]."' ><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings) echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage&name=". $_POST['name']. '&zipcode=' . $_POST['zipcode'] .'&state=' . $_POST['state'] . '&food_types= ' . $_POST['frmSearch']['food_types'][0]. '&offerings=' . $_POST['frmSearch']['offerings'][0]."'><</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b >$x</b>] "; // if not current page... } else { // make it a link http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings) echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings) echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage&name=". $_POST['name']. '&zipcode=' . $_POST['zipcode'] .'&state=' . $_POST['state'] . '&food_types= ' . $_POST['frmSearch']['food_types'][0]. '&offerings=' . $_POST['frmSearch']['offerings'][0]."'>></a> "; // echo forward link for lastpage http_build_query( $strName,$strZipCode, $strState, $arrFoodTypes, $arrOfferings) echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages&name=". $_POST['name']. '&zipcode=' . $_POST['zipcode'] .'&state=' . $_POST['state'] . '&food_types= ' . $_POST['frmSearch']['food_types'][0]. '&offerings=' . $_POST['frmSearch']['offerings'][0]."'>>></a> "; } // end if } ?> } </div> <div class="clearer"></div> </div> </div> Link to comment https://forums.phpfreaks.com/topic/189439-parse-error-help/#findComment-999962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.