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
Type
Date
FromLoc
ToLoc
Length(m)
Width(m)
Depth(m)
Area(m2)
Volume(m3)
Remarks
if(isset($_GET['s']))
{
$s=$_GET['s'];
}
$query = "select * from r02 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['type'];
if(!empty($string4)){
$query.=" type like '%$string4%' and ";
}
$string5 = $_GET['date'];
if(!empty($string5)){
$query.=" date like '%$string5%' and ";
}
$string6 = $_GET['fromloc'];
if(!empty($string6)){
$query.=" fromloc like '$string6%' and ";
}
$string7 = $_GET['toloc'];
if(!empty($string7)){
$query.=" toloc like '$string7%' and ";
}
$string8 = $_GET['length'];
if(!empty($string8)){
$query.=" length like '$string8%' and ";
}
$string9 = $_GET['width'];
if(!empty($string9)){
$query.=" width like '$string9%' and ";
}
$string10 = $_GET['depth'];
if(!empty($string10)){
$query.=" depth like '$string9%' and ";
}
$string11 = $_GET['area'];
if(!empty($string11)){
$query.=" area like '$string9%' and ";
}
$string12 = $_GET['volume'];
if(!empty($string12)){
$query.=" volume 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))
{
$r2id=$rw->r2id;
$centre=$rw->centre;
$district=$rw->district;
$road=$rw->road;
$type=$rw->type;
$date=$rw->date;
$fromloc=$rw->fromloc;
$toloc=$rw->toloc;
$length=$rw->length;
$width=$rw->width;
$depth=$rw->depth;
$area=$rw->area;
$volume=$rw->volume;
$remark=$rw->remark;
?>
echo $No; ?>
echo $centre; ?>
echo $district; ?>
echo $road; ?>
echo $type; ?>
echo $date; ?>
echo $fromloc; ?>
echo $toloc; ?>
echo $length; ?>
echo $width; ?>
echo $depth; ?>
echo $area; ?>
echo $volume; ?>
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;
//}
?>