mat3000000 Posted October 12, 2011 Share Posted October 12, 2011 Getting This Error, anyone know why? (Line 410 is the line after my page code ends) Here is my code... function URL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } $url = URL(); if(empty($errors)){ $sort = $_GET['sort']; $s = $_GET['s']; $limit=15; if($sort == 'Distance') {$query = "SELECT ((ACOS(SIN('$b_lat' * PI() / 180) * SIN(`lat` * PI() / 180) + COS('$b_lat' * PI() / 180) * COS(`lat` * PI() / 180) * COS(('$b_long' - `long`) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS `distance`,username,sector,job,description,pay,reqexp, jobtime, hours, hourscat FROM `staff` WHERE sector='$sector' AND job='$job' "; if(!$hrs==''){$query .= "AND hourscat='$hrs' "; if(!$pay==''){$query .= "AND pay>='$pay' "; if(!$jobtime==''){$query .= "AND jobtime='$jobtime' "; $query .= "ORDER BY `distance` DESC"; } $numresults=mysql_query($query); $numrows=mysql_num_rows($numresults); // If we have no results if ($numrows == 0) { $rslts = "<br /><tr><td>Sorry, there are currently no customer advertisements on our system</td></tr>"; } if ($numrows > 0){ // next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; } //Get Results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("The search failed"); // begin to show results set $count = 1 + $s ; $rslts = ''; // now you can display the results returned while ($row= mysql_fetch_array($result)) { $username = $row['username']; $sector = $row['sector']; $job = $row['job']; $desc = $row['decription']; $exp = $row['reqexp']; $pay = $row['pay']; $jobtime = $row['jobtime']; $hours = $row['hours']; $distance = round($row['distance'],1); $rslts .= "<br /><table class='profilebox' style='padding:10px;'> <tr> <td width='120' height='120' align='center'><a href='viewjob.php?user=$username' style='border:none;'> <img src='/bus/files/$username/profilepic/tn_profilepic.jpg'</td> <td width='40'> </td> <td width='190'> $sector - $job<br /><br /><br /> Experience Required: $exp years<br /><br /> Pay: £$pay /hr<br /></td> <td width='40'> </td> <td width='70'><br /><br /><br />Hours: £$hours<br />Job Time: $jobtime</td> <td width='40'> </td> <td valign='bottom' align='right' width='160'> Distance: $distance miles </td> </tr> </table> "; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging $rslts .= "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); $prree ="<b><a class='np' href='$url&s=$prevs'><< Previous Page</a></b>   "; } // calculate number of pages needing links $pages=intval($numrows/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($numrows%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; $nachste = "<b><a class='np' href='$url&s=$news'>Next Page >></a></b>"; } $a = $s + ($limit) ; if ($a > $numrows) { $a = $numrows ; } $b = $s + 1 ; $pages123 = "<table width='93%' align='center'><tr><td height='30' valign='bottom'><p class='np'> $prree $nachste </p><p style='font-size:10px;'>Showing results $b to $a of $numrows</p></td></tr></table>"; } echo $pages123 . $pageslist . $rslts . $pages123; }//end $numrows >0 ?> Quote Link to comment https://forums.phpfreaks.com/topic/248983-parse-error-syntax-error-unexpected-end-in-resultsphp-on-line-410/ Share on other sites More sharing options...
Pikachu2000 Posted October 12, 2011 Share Posted October 12, 2011 That error is nearly always caused by a missing closing } curly brace. Format your code in your editor so it's properly indented, and match up the braces. Quote Link to comment https://forums.phpfreaks.com/topic/248983-parse-error-syntax-error-unexpected-end-in-resultsphp-on-line-410/#findComment-1278658 Share on other sites More sharing options...
Muddy_Funster Posted October 12, 2011 Share Posted October 12, 2011 I only count 163 lines in the code that's posted, did you trim it or are you perhaps posting the wrong page? Quote Link to comment https://forums.phpfreaks.com/topic/248983-parse-error-syntax-error-unexpected-end-in-resultsphp-on-line-410/#findComment-1278660 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.