} else { if (!empty($searchparameter)) { $showfacility = "SELECT ID, facilitycode,LTRIM(RTRIM(name)),district,telephone,telephone2,email,contactperson,PostalAddress FROM facilitys WHERE name LIKE '%{$searchparameter}%' AND flag = 1"; $displayfacilities = @mysql_query($showfacility) or die(mysql_error()); $showfacilitycount = mysql_num_rows($displayfacilities); echo "The search for <strong>{$searchparameter}</strong> returned <strong>{$showfacilitycount}</strong> results.<a href='facilitieslist.php'><strong>Click here to refresh page.</strong></a>"; //display search echo "<table border=0 class='data-table'>\n\t<tr ><th>Facility Code</th><th>Facility Name</th><th>District</th><th>Province</th><th>Land Line</th><th>Mobile No</th><th>Address</th><th>Email Address</th><th>Contact Person</th><th>Task</th></tr>"; //list the variables that you would like to get while (list($ID, $facilitycode, $name, $district, $telephone, $telephone2, $email, $contactperson, $PostalAddress) = mysql_fetch_array($displayfacilities)) { //get select district name and province id $distname = GetDistrictName($district); //get province ID $provid = GetProvid($district); //get province name $provname = GetProvname($provid); //display the facility name //$facilityname = GetFacility($ID); //display the facility information as well as the facility name and type echo "<tr class='even'>\n\t\t\t\t\t\t<td >{$facilitycode}</td>\n\t\t\t\t\t\t<td >{$name}</td> \n\t\t\t\t\t\t<td >{$distname}</td> \n\t\t\t\t\t\t<td >{$provname}</td>\n\t\t\t\t\t\t<td >{$telephone}</td>\n\t\t\t\t\t\t<td >{$telephone2}</td>\n\t\t\t\t\t\t<td>{$PostalAddress} </td>\n\t\t\t\t\t\t<td ><a href='mailto:{$email}'>{$email}</a></td>\n\t\t\t\t\t\t<td >{$contactperson}</td>\n\t\t\t\t\t\t<td ><a href=\"facilitydetails.php" . "?ID={$ID}" . "\" title='Click to view Facility Details'>View </a> | <a href=\"editfacility.php" . "?facilitycode={$facilitycode}" . "\" title='Click to view Facility Details'>Edit</a> | <a href=\"deletefacility.php" . "?ID={$ID}&fname={$name}" . "\" title='Click to Delete Facility' OnClick=\"return confirm('Are you sure you want to delete Worksheet {$name}');\" >Delete </a>\n\t\t\t\t</td>\n\t\t\t\t\t</tr>"; } echo "</table>"; $numrows = $showfacilitycount; //get total no of batches // how many pages we have when using paging? $maxPage = ceil($numrows / $rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for ($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) {
} else { if (!empty($searchparameter)) { //query database for all districts $districtsquery = "SELECT LTRIM(RTRIM(name)),province,comment FROM districts WHERE name LIKE '%{$searchparameter}%' AND flag = 1"; $result = mysql_query($districtsquery) or die(mysql_error()); //for main display $no = mysql_num_rows($result); echo "The search for <strong>{$searchparameter}</strong> returned <strong>{$no}</strong> results.<a href='districtslist.php'><strong>Click here to refresh page.</strong></a>"; /* <!-- ***************************************************************** -->*/ echo '<table border="0" class="data-table"> <tr ><th>Count</th><th>Name</th><th>Province</th><th>Comment(s)</th></tr>'; /*<!--*********************************************************** -->*/ $displaycount = 0; while (list($name, $province, $comment) = mysql_fetch_array($result)) { //display the province name $provincename = GetProvname($province); $displaycount = $displaycount + 1; //display the table echo "<tr >\n\t\t\t\t\t\t\t\t\t<td >{$displaycount}</td>\n\t\t\t\t\t\t\t\t\t<td >{$name}</td>\n\t\t\t\t\t\t\t\t\t<td >{$provincename}</td>\n\t\t\t\t\t\t\t\t\t<td >{$comment}</td>\n\t\t\t\t\t\t\t\t\t</tr>"; } echo "</table>"; /*<!--*********************************************************** -->*/ $numrows = $no; //get total no of batches // how many pages we have when using paging? $maxPage = ceil($numrows / $rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for ($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) {