include "../../database/member.php";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
?>
Search
No
Centre
District
RoadName
Date
Chainage(km)
BridgeName
Qty
Type
WorkDetail
Remark
if(isset($_GET['s']))
{
$s=$_GET['s'];
}
$query = "select * from r05b where";
$string1 = $_GET['centre'];
if(!empty($string1)){
$query.=" centre like '%$string1%' and ";
}
$string2 = $_GET['district'];
if(!empty($string2)){
$query.=" district like '%$string2%' and ";
}
$string3 = $_GET['road'];
if(!empty($string3)){
$query.=" road like '%$string3%' and ";
}
$string4 = $_GET['date'];
if(!empty($string4)){
$query.=" date like '%$string4%' and ";
}
$string5 = $_GET['location'];
if(!empty($string5)){
$query.=" location like '$string5%' and ";
}
$string6 = $_GET['bgname'];
if(!empty($string6)){
$query.=" bgname like '%$string6%' and ";
}
$string7 = $_GET['qty'];
if(!empty($string7)){
$query.=" qty like '%$string7%' and ";
}
$string8 = $_GET['type'];
if(!empty($string8)){
$query.=" type like '%$string8%' and ";
}
$string9 = $_GET['work'];
if(!empty($string9)){
$query.=" work like '%$string9%' and ";
}
$query = substr($query, 0, -4);
//$string3 = $_GET['pants'];
// rows to return
$limit=30;
//$id = $_POST['id'];
//$ordertype = $_POST['ordertype'];
//$shirt = $_POST['shirt'];
//$pants = $_POST['pants'];
//$shoes = $_POST['shoes'];
//$ordertypeNoWhere ='ordertype like "%'.$ordertype.'%"';
//$shirtNoWhere ='shirt like "%'.$shirt.'%"';
//$pantsNoWhere ='pants like "%'.$pants.'%"';
//$sqlWhereJoint=' WHERE '.$ordertypeNoWhere.$shirtNoWhere.$pantsNoWhere;
//if ($ordertype != '') {
//$ordertypeNoWhere='ordertype like "%'.$ordertype.'%"';
//}
//if ($ordertype == '') {
// if (($prDateFrom != '') && ($prDateTo == '')){
// $prDateTo=$prDateFrom;
// }
// if (($prDateTo != '') && ($prDateFrom == '')){
// $prDateFrom=$prDateTo;
// }
// if (($prDateFrom != '') && ($prDateTo != '')){
// $prDateWhere = ' prDate BETWEEN "'.$prDateFrom.'" AND "'.$prDateTo.'"';
// }
//}
//else
//{
// if (($prDateFrom != '') && ($prDateTo == '')){
// $prDateTo=$prDateFrom;
// }
// if (($prDateTo != '') && ($prDateFrom == '')){
// $prDateFrom=$prDateTo;
// }
// if (($prDateFrom != '') && ($prDateTo != '')){
// $prDateWhere = ' AND prDate BETWEEN "'.$prDateFrom.'" AND "'.$prDateTo.'"';
// }
//}
//if (($prPRFNo == '') && ($prDateTo == '') && ($prDateFrom == '')) {
//echo 'UNABLE TO SEARCH FOR RESULT. DATA REQUIRED!';
//exit;
//}
//$sqlWhereJoint=' WHERE '.$prPRFNoWhere.$prDateWhere;
//$sql = "select * from page where";
//if(!empty($ordertype)){
// $sql.=" ordertype like '%$ordertype%' and ";
//}
//if(!empty($shirt)){
// $sql.=" shirt like '%$shirt%' and ";
//}
//$sql = substr($sql, 0, -4);
//$query = "select * from page where ordertype like \"%$trimmed1%\" or shirt like \"%trimmed2%\"
//order by id";
$numresults=mysql_query($query) or die(mysql_error());
$numrows=mysql_num_rows($numresults);
if (empty($s)) {
$s=0;
}
// get results
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
// begin to show results set
echo "Results";
$No = 1 + $s;
$count = 1 + $s ;
//$sql = "Select * From page where ordertype like '%$ordertype%' || shirt like '%$shirt%'";
//$sql = "Select * From pr";
//$rs = mysql_query($sql) or die(mysql_error());
//if ($rs)
//{
while ($rw = mysql_fetch_object($result))
{
$r5bid=$rw->r5bcid;
$centre=$rw->centre;
$district=$rw->district;
$road=$rw->road;
$date=$rw->date;
$location=$rw->location;
$bgname=$rw->bgname;
$qty=$rw->qty;
$type=$rw->type;
$work=$rw->work;
$remark=$rw->remark;
?>
echo $No; ?>
echo $centre; ?>
echo $district; ?>
echo $road; ?>
echo $date; ?>
echo $location; ?>
echo $bgname; ?>
echo $qty; ?>
echo $type; ?>
echo $work; ?>
echo $remark; ?>
$No++;
$count++ ;
}
$currPage = (($s/$limit) + 1);
?>
// next we need to do the links to other results
if ($s>=1) { // bypass PREV link if s is 0
$prevs=($s-$limit);
print " <<
Prev   ";
}
// 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;
echo " Next>> ";
}
$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo "Showing results $a of $numrows
";
//}
//else
//{
// $html = "
// RECORD
// Empty ";
//echo $html;
//}
?>