Jump to content

Parse error: syntax error, unexpected $end in /results.php on line 410


mat3000000

Recommended Posts

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>&nbsp&nbsp ";
  }

// 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

?>          

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.