Forum Moderators: coopster
Parse error: syntax error, unexpected $end in C:\wamp\www\SPFIS\Admin\master_written_material.php on line 224
this is from second page actually.
I dont know what is not working in here...
below I've added the code for the second page for u to see how I've created the search part in my second page...
anyone any Idea why it gives me this error?
<?php require_once('../Connections/SPFIS.php');
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_SPFIS, $SPFIS);
if(
(empty($_POST['date'])) &&
(empty($_POST['subject'])) &&
(empty($_POST['category'])) &&
(empty($_POST['priority']))
)
echo "You must fill at least one field";
else {
$clause = array();
if(!empty($_POST['date'])) $clause[] = "date='" . mysql_real_escape_string($_POST['date']) . "'";
if(!empty($_POST['subject'])) $clause[] = "subject='" . mysql_real_escape_string($_POST['subject']) . "'";
if(!empty($_POST['category'])) $clause[] = "category='" . mysql_real_escape_string($_POST['category']) . "'";
if(!empty($_POST['priority'])) $clause[] = "priority='" . mysql_real_escape_string($_POST['priority']) . "'";
$where = implode(") AND (",$clause); // This gives the middle
$where = "WHERE (" . $where . ")"; // This adds on the "ends"
//$query_Recordset1 = "SELECT * FROM exam_papers $where";
$query_Recordset1 = "SELECT paper_no, `date`, subject, category, priority FROM written_materials $where ORDER BY `date` DESC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $SPFIS) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
.
.
.
and then my html starts...
.
.
.
<body>
<table border="1" align="center" id="table-main">
<tr>
<th>paper_no</th>
<th>date</th>
<th>subject</th>
<th>category</th>
<th>priority</th>
</tr>
<?php do { ?>
<tr>
<td><a href="update_written_material.php?recordID=<?php echo $row_Recordset1['paper_no']; ?>"> <?php echo $row_Recordset1['paper_no']; ?> </a> </td>
<td><?php echo $row_Recordset1['date']; ?> </td>
<td><?php echo $row_Recordset1['subject']; ?> </td>
<td><?php echo $row_Recordset1['category']; ?> </td>
<td><?php echo $row_Recordset1['priority']; ?> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<div align="center"><br />
<table border="0" id="Navigation">
<tr>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
<?php } // Show if not first page ?> </td>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
<?php } // Show if not first page ?> </td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
<?php } // Show if not last page ?> </td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<p align="center" id="Navigation" style="font-weight:bold">Records <?php echo ($startRow_Recordset1 + 1) ?> to <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
else {
The first part of the statement has no braces, so try changing that:
if(
(empty($_POST['date'])) &&
(empty($_POST['subject'])) &&
(empty($_POST['category'])) &&
(empty($_POST['priority']))
) {
echo "You must fill at least one field";} else {
dc