|
|
| Motorcycle Community
 |
| Motorcycle Competitions
 |
| Motorcycle Galleries
 |
| Motorcycles General
 |
|
|
|
| |
|
Classified Advertising
|
//
?>
|
if(isset($_GET['NAV'])){
$iPage = $_GET['NAV'];
}else{
$iPage = 1;
}
if(isset($_GET['type'])){
$iID = $_GET['type'];
}
else{
$iID = "";
}
if(isset($_GET['model'])){
$imodel = $_GET['model'];
}
else{
$imodel = "";
}
$lprice = 0;
if(isset($_GET['lprice'])){
$lprice = $_GET['lprice'];
}
else{
$lprice = 0;
}
$hprice = 200000000000;
if(isset($_GET['hprice'])){
$hprice = $_GET['hprice'];
}
else{
$hprice = 200000000000;
}
$postcode = "ZZ";
if(isset($_GET['postcode'])){
$postcode = $_GET['postcode'];
}
else{
$postcode = "ZZ";
}
$tpostcode = trim($postcode);
// if (is_numeric(substring($tpostcode,3,1)) or substring($tpostcode,3,1) = " " or substring($tpostcode,3,1) = "" )
//{$tppc = substring(tpostcode,1,2);}
//if (is_numeric(substring($tpostcode,2,1)) or substring($tpostcode,2,1) = " " or substring($tpostcode,2,1) = "" )
$tppc = substr($tpostcode,0,2);
$tppc = strtoupper($tppc);
$pclength = strlen($tppc);
// echo $pclength;
?>
/*
*/ ?>
$mysql = mysql_connect("localhost","402441_admin","NuvvMJ..");
mysql_select_db( "402441_motorbikenews" ); ?>
$rowsPerPage = 6;
$query = "SELECT COUNT(make) AS numrows FROM newclass_ads WHERE price > ".$lprice." and price < ".$hprice." ";
if ( $iID <> "All" ) { $query = $query . " and make = '".$iID."' ";}
if ( $imodel <> "All" ) { $query = $query . " and model = '".$imodel."' ";}
if ( $tppc <> "ZZ" and $pclength == 2) { $query = $query . " and left(trim(postcode),2) = '".$tppc."' "; }
if ( $tppc <> "ZZ" and $pclength == 1) { $query = $query . " and ( left(trim(postcode),2) = '".$tppc."0' or left(trim(postcode),2) = '".$tppc."1' or left(trim(postcode),2) = '".$tppc."2' or left(trim(postcode),2) = '".$tppc."3' or left(trim(postcode),2) = '".$tppc."4' or left(trim(postcode),2) = '".$tppc."5' or left(trim(postcode),2) = '".$tppc."6' or left(trim(postcode),2) = '".$tppc."7' or left(trim(postcode),2) = '".$tppc."8' or left(trim(postcode),2) = '".$tppc."9' )"; }
//echo $query;
//$query = "SELECT COUNT(make) AS numrows FROM newclass_ads WHERE make = '".$iID."' and price > ".$lprice." and price < ".$hprice." " ;
$result = mysql_query($query) or die('Error!!!!!!, query failed 1' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$iRecordcount = $row['numrows'];
// echo $iRecordcount;
// how many pages we have when using paging?
$iPagecount = ceil($iRecordcount/$rowsPerPage);
If ($iPage > $iPagecount) { $iPage=$iPagecount ;}
$offset = ($iPage - 1) * $rowsPerPage;
if ($iPagecount > 1 ) {
?>
$self = $_SERVER['PHP_SELF'];
if ($iPage > 1)
{
$page = $iPage - 1;
$prev = "  ";
$first = "  ";
}
else
{
$prev = "  "; // we're on page one, don't enable 'previous' link
$first = "  "; // nor 'first page' link
}
// print 'next' link only if we're not
// on the last page
if ($iPage < $iPagecount)
{
$page = $iPage + 1;
// $next = "  ";
$next = "  ";
$last = "  ";
}
else
{
$next = "  "; // we're on the last page, don't enable 'next' link
$last = "  "; // nor 'last page' link
}
// print the page navigation link
echo " | " .
"" .
$first . $prev . " Showing page $iPage of $iPagecount pages " . $next . $last .
" |
";
?>
}
if ($iRecordcount > 0 ) {
$query = "SELECT * FROM newclass_ads where make = '".$iID."' and model = '".$imodel."' and price > ".$lprice." and price < ".$hprice." and left(trim(postcode),2) = '".$tppc."' order by primkey LIMIT $offset, $rowsPerPage ";
$query = "SELECT * FROM newclass_ads WHERE price > ".$lprice." and price < ".$hprice." ";
if ( $iID <> "All" ) { $query = $query . " and make = '".$iID."' ";}
if ( $imodel <> "All" ) { $query = $query . " and model = '".$imodel."' ";}
if ( $tppc <> "ZZ" and $pclength == 2) { $query = $query . " and left(trim(postcode),2) = '".$tppc."' "; }
if ( $tppc <> "ZZ" and $pclength == 1) { $query = $query . " and ( left(trim(postcode),2) = '".$tppc."0' or left(trim(postcode),2) = '".$tppc."1' or left(trim(postcode),2) = '".$tppc."2' or left(trim(postcode),2) = '".$tppc."3' or left(trim(postcode),2) = '".$tppc."4' or left(trim(postcode),2) = '".$tppc."5' or left(trim(postcode),2) = '".$tppc."6' or left(trim(postcode),2) = '".$tppc."7' or left(trim(postcode),2) = '".$tppc."8' or left(trim(postcode),2) = '".$tppc."9' )"; }
$query = $query . " order by primkey LIMIT $offset, $rowsPerPage ";
//echo $query;
// $query = "SELECT * FROM newclass_ads where make = '".$iID."' and price > ".$lprice." and price < ".$hprice." order by primkey LIMIT $offset, $rowsPerPage ";
$result = mysql_query($query) or die('Error!!!!!!, query failed 2');
while ( $DOC = mysql_fetch_object( $result ) )
{ ?>
$adclass = "bronze" ;
$adclass2 = "bronzehead" ;
$adclass3 = "bronzebody" ;
$detbut = "viewadb.gif" ;
if ($DOC->adtype == 10 ){
$adclass = "gold" ;$adclass2 = "goldhead" ;$adclass3 = "goldbody" ;$detbut = "viewadg.gif" ;}
if ($DOC->adtype == 5 ){
$adclass = "silver" ; $adclass2 = "silverhead" ;$adclass3 = "bronzebody" ;$detbut = "viewads.gif" ;}
echo '';
?>
echo ' ';
$pricey = $DOC->price;
if ( is_null ($DOC->price) ) { $pricey = "N/A" ; }
echo ' £'.$pricey.' | | '.$DOC->make.' ' .$DOC->model.' | ';
echo '| ';
$texty = substr ($DOC->comments,0,250);
echo $texty;
?>
|
|
$lggoD = $DOC->logoimg;
if ($lggoD != "http://motorcyclesupermarket.com/images/dealerLogos/images/"){
echo ' ';
}
?>
|
$tp = "";
if ( $DOC->tp == "T" ) {$tp = "(T)rader";}
if ( $DOC->tp == "P" ) {$tp = "(P)rivate";}
$upc = $DOC->postcode;
?>
|
| |
if ($DOC->weblink == "" )
{ echo ' | '; }
else {
echo ' | '; }
?>
|
|
}
} else
{ echo "There are no results that meet your selections. Please try a different selection
";}
if ($iPagecount > 1 ) {?>
$self = $_SERVER['PHP_SELF'];
if ($iPage > 1)
{
$page = $iPage - 1;
$prev = "  ";
$first = "  ";
$prev = "  ";
$first = "  ";
}
else
{
$prev = "  "; // we're on page one, don't enable 'previous' link
$first = "  "; // nor 'first page' link
}
// print 'next' link only if we're not
// on the last page
if ($iPage < $iPagecount)
{
$page = $iPage + 1;
// $next = "  ";
$next = "  ";
$last = "  ";
$next = "  ";
$last = "  ";
}
else
{
$next = "  "; // we're on the last page, don't enable 'next' link
$last = "  "; // nor 'last page' link
}
// print the page navigation link
echo " | " .
"" .
$first . $prev . " Showing page $iPage of $iPagecount pages " . $next . $last .
" |
";
?>
} ?>
| |
| | | |
|