} } else { $defaultmonth = date("M-Y"); //get current month and year $currentmonth = date("m"); $currentyear = date("Y"); } $province = $_GET['province']; // Use this line or below line if register_global is off $provincequery = mysql_query("select Name from provinces where ID='{$province}'") or die(mysql_error()); $provarray = mysql_fetch_array($provincequery); $provincename = $provarray['Name']; if ($_REQUEST['districtfilter']) { $dcode = $_POST['dcode']; // Use this line or below line if register_global is off $dname = GetDistrictName($dcode); if ($dcode != "") { $dist = "," . '<u>' . $dname . " District" . '</u>'; } else { $dist = ""; } //echo "District: ".$dname . " - ".$currentyear ." / " .$currentmonth; } if ($_REQUEST['facilityfilter']) { //$fcode=$_POST['fcode']; // Use this line or below line if register_global is off $fcode = $_POST['cat']; $fname = GetFacilityName($fcode); //facility if ($fcode != "") { $dist = "," . '<u>' . $fname . '</u>'; } else {
// nor the last page link } // print the navigation link echo '<center>' . $first . $prev . $next . $last . '</center>'; } 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