OK..
this is my script:
extract($_GET);
if(!require(config.php)){
echo 'Could not get the config. Some stupid error occured.';
exit;
}
$mysqlConnect = mysql_connect($mysqHost, $mysqlUser, $mysqlPassword);
mysql_select_db($mysqlDB);
// Prepare query
if(!isset($bscmember) || $bscmember == 'no'){
if($action == 'tgrp'){
$getPupils = 'SELECT * FROM pupils WHERE tgrp = \'' . $tgrp . '\' ORDER BY name ASC';
}
elseif($action == 'ygrp'){
$getPupils = 'SELECT * FROM pupils WHERE ygrp = \'' . $ygrp . '\' ORDER BY name ASC';
}
elseif($action == 'gender'){
$getPupils = 'SELECT * FROM pupils ORDER BY gender ASC';
}
else{
$getPupils = 'SELECT * FROM pupils ORDER BY name ASC';
}
}
else{
if($action == 'tgrp'){
$getPupils = 'SELECT * FROM pupils WHERE tgrp = \'' . $tgrp . '\' AND bscmember = true ORDER BY name ASC';
}
elseif($action == 'ygrp'){
$getPupils = 'SELECT * FROM pupils WHERE ygrp = \'' . $ygrp . '\' AND bscmember = true ORDER BY name ASC';
}
elseif($action == 'gender'){
$getPupils = 'SELECT * FROM pupils WHERE bscmember = true ORDER BY gender ASC';
}
else{
$getPupils = 'SELECT * FROM pupils WHERE bscmember = true ORDER BY name ASC';
}
}
// Do pagination stuff
// I'm guessing you want to LIMIT this, you can do this:
$recordsPerPage = 30;
$currentPage = $_GET["page"];
$currentRecord = ($currentPage-1) * $recordsPerPage;
$query = $getPupils . ' LIMIT $currentRecord, $recordsPerPage';
$result = mysql_query($query);
// FETCH NUMBER OF PAGES
$numPages = (mysql_num_rows($result)%$recordsPerPage);
echo '<table width="100%">' . "\n";
echo '<tr><td>A few tds</td></tr>';
while ($pupil = mysql_fetch_assoc($result)) {
echo '<tr><td>' . $pupil['id'] . '</td><td>' . $pupil['name'] . '</td><td>' . $pupil['ygrp'] . '</td><td>' . $pupil['tgrp'] . '</td><td>' . $pupil['bscmember'] . '</td></tr> . "\n";
}
?>
</table>
<?php
// CREATE THE PAGINATION
$nextPage = ($currentPage == $numPages) ? $numPages : ($currentPage+1);
$prevPage = ($currentPage == 1) ? 1 : ($currentPage-1);
echo "<a href=\"index.php?page=$prevPage\">Previous Page</a> ";
for ($i = 1; $i <= $numPages; $i++) {
echo "<a href=\"index.php?page=$i\">$i</a> ";
}
echo "<a href=\"index.php?page=$nextPage\">Next page</a> ";
?>
</body>
</html> // Line 89
and this is my error:
Parse error: syntax error, unexpected $end in /home/isaac/public_html/thepeccavi/bsc/pupils/view.php on line 89
Exactly what am I doing wrong?