I need a help with php i have a query it generate result that list of cars and i want is divide in to pages here im giving the table structure and the php file can help me on this

Table Structute

CREATE TABLE IF NOT EXISTS `cars` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `make` varchar(50) NOT NULL,
  `model` varchar(50) NOT NULL,
  `trans` varchar(50) NOT NULL,
  `fuel` varchar(50) NOT NULL,
  `year` int(11) NOT NULL,
  `km` int(11) NOT NULL,
  `vin` int(11) NOT NULL,
  `regdetails` varchar(50) NOT NULL,
  `state` varchar(50) NOT NULL,
  `price` varchar(100) NOT NULL,
  `features` varchar(1000) NOT NULL,
  `pic1` varchar(5000) NOT NULL,
  `pic2` varchar(5000) NOT NULL,
  `pic3` varchar(5000) NOT NULL,
  `pic4` varchar(5000) NOT NULL,
  `pic5` varchar(5000) NOT NULL,
  `pic6` varchar(5000) NOT NULL,
  `uname` varchar(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `uname` (`uname`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;

--
-- Dumping data for table `cars`
--

INSERT INTO `cars` (`id`, `make`, `model`, `trans`, `fuel`, `year`, `km`, `vin`, `regdetails`, `state`, `price`, `features`, `pic1`, `pic2`, `pic3`, `pic4`, `pic5`, `pic6`, `uname`) VALUES
(14, 'ALFA ROMEO ', 'ALFA', 'Automatic', 'Gasoline/Petrol', 2009, 0, 0, 'Unregisted', 'Northern Territory', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>A/C:front</li><li>Cruise Control</li><li>Navigation System</li><li>Power Steering</li><li>Remote Keyless Entry</li><li>Tilt Wheel</li><li>Digital Meter</li><li>Child Seat</li><li>Leather Seats</li><li>Power Seats</li><li>Bucket Seat</li><li>Power Windows</li><li>Rear Window Wiper</li><li>Tinted Glass</li><li>AM/FM Radio</li><li>AM/FM Stereo</li><li>CD Changer</li><li>CD Player</li><li>Premium Sound</li><li>Satellite Radio</li><li>DVD</li><li>TV</li><li>Alloy Wheels</li><li>Power Door Locks</li><li>Power Mirrors</li><li>Sunroof</li><li>Third Row Seats</li><li>Power Slide Door</li><li>Custom wheels</li><li>Fully loaded</li><li>Maintenance records available</li><li>New paint</li><li>New tires</li><li>No accidents</li><li>One owner</li><li>Performance tires</li><li>Upgraded sound system</li><li>Turbo</li>', './adpics/AlfaRomeoC8.jpg', './adpics/Alfa-Romeo-8c-Competizione.jpg', './adpics/alfa-romeo-8c.jpg', './adpics/alfa-8c.jpg', './adpics/alfa8c.jpg', './adpics/2003_Alfa_Romeo_8C_Competizione_Concept.jpg', 'nirman'),
(11, 'BMW ', 'M3', 'Automatic', 'Diesel', 2007, 123, 0, 'Unregisted', 'Western Australia', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>Power Door Locks</li><li>Power Mirrors</li>', './adpics/2009_Camaro_1.jpg', './adpics/0007500089184_500X500.jpg', './adpics/0088732421005_AV_500X500.jpg', './adpics/AustraliaMap.png', './adpics/Iloverock.gif', './adpics/YeahIloverock.jpg', 'ruwanaru'),
(12, 'BMW ', 'M3', 'Automatic', 'Diesel', 2009, 123, 0, 'Unregisted', 'Western Australia', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>Power Door Locks</li><li>Power Mirrors</li>', './adpics/2009_Camaro_1.jpg', './adpics/0007500089184_500X500.jpg', './adpics/0088732421005_AV_500X500.jpg', './adpics/AustraliaMap.png', './adpics/Iloverock.gif', './adpics/YeahIloverock.jpg', 'ruwanaru'),
(13, 'AUDI ', 'R8', 'Automanual', 'Gasoline/Petrol', 2008, 123, 0, 'Unregisted', 'Northern Territory', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>A/C:front</li><li>Cruise Control</li><li>Navigation System</li><li>Power Windows</li><li>DVD</li>', './adpics/2009_Camaro_1.jpg', './adpics/0007500089184_500X500.jpg', './adpics/2009_Camaro_1.jpg', './adpics/AustraliaMap.png', './adpics/2009_Camaro_1.jpg', '../adpics/2009_Camaro_1.jpg', 'nirman'),
(15, 'ALFA ROMEO ', 'ALFA', 'Automatic', 'Gasoline/Petrol', 2009, 0, 0, 'Unregisted', 'Northern Territory', 'ASK', '<li>Anti-Lock Brakes(ABS)</li><li>Driver Airbag</li><li>Passenger Airbag</li><li>Side Airbag</li><li>Alarm</li><li>A/C:front</li><li>Cruise Control</li><li>Navigation System</li><li>Power Steering</li><li>Remote Keyless Entry</li><li>Tilt Wheel</li><li>Digital Meter</li><li>Child Seat</li><li>Leather Seats</li><li>Power Seats</li><li>Bucket Seat</li><li>Power Windows</li><li>Rear Window Wiper</li><li>Tinted Glass</li><li>AM/FM Radio</li><li>AM/FM Stereo</li><li>CD Changer</li><li>CD Player</li><li>Premium Sound</li><li>Satellite Radio</li><li>DVD</li><li>TV</li><li>Alloy Wheels</li><li>Power Door Locks</li><li>Power Mirrors</li><li>Sunroof</li><li>Third Row Seats</li><li>Power Slide Door</li><li>Custom wheels</li><li>Fully loaded</li><li>Maintenance records available</li><li>New paint</li><li>New tires</li><li>No accidents</li><li>One owner</li><li>Performance tires</li><li>Upgraded sound system</li><li>Turbo</li>', './adpics/AlfaRomeoC8.jpg', './adpics/Alfa-Romeo-8c-Competizione.jpg', './adpics/alfa-romeo-8c.jpg', './adpics/alfa-8c.jpg', './adpics/alfa8c.jpg', './adpics/2003_Alfa_Romeo_8C_Competizione_Concept.jpg', 'nirman');

PHP file

<?php
    include("init/db.php");
	$yearfom = $_POST["yearFrom"];
	$yearTo = $_POST["yearTo"];
	
	
	$Year ="SELECT";
	
	if($yearfom!="SELECT"){
		$Year ="";
		}
	
		$content = array("make"=>$_POST["make"],
					 "model"=>$_POST["model"],
					 "year"=>"$Year" );


   
    $validValues=array();

	foreach ($content as $key=>$value)
	{
		if($value != "SELECT")
		  {
			 $validValues[$key]=$value;	
							
		  }
		  
	}
	
	$query ="select * from cars where ";
	foreach($validValues as $key=>$value)
	{

		$query1 = $query.$key."='".$value."' AND ";
		$qu1=true;
		if($key == "year"){
			$query1 = substr($query1,0,-8);
			$query2 = $query1." BETWEEN '".$yearfom."' AND ' ".$yearTo."'";
			$qu1=false;
			$qu2=true;
			
			}
			
				
	}
	
	if($qu1==true){
	$query = substr($query1,0,-4);
	
	}elseif($qu2==true){
		
		$query = $query2;
		}		
		
	echo $query;
	$result=mysql_query($query);
	  $row=mysql_num_rows($result);
 if($row>0){ 	
	while ($info=mysql_fetch_array($result)){
	

    
	 $make = $info['make'];
	  $model = $info['model'];
	  $price = $info['price'];
	  $features = $info['features'];
	  $year= $info['year'];
	  
	 $pic1=$info['pic1'];
	 $pic2=$info['pic2'];
	  $pic3=$info['pic3'];
				   
		   
	  $id = $info['id'];
	  $desc=str_replace ("<li>", "   ", $features);
	  
	   $ftt = substr($desc,0,120)."................."; 
	    $abc="'viewad.php?id=$id'";


echo	'<div id="adcontent"><a  onclick="javascript:popUp('.$abc.')"">
	<div id="cars">
  			<div style="background-color:#0091DE; padding:5px; font-weight: bold; color:#FFF;">
   		 '.$make.' - '.$model.' -  '.$year.'
     	    </div>
 			 <div style="padding:10px; font-size: 30px;">
      			<img src="'.$pic1.'" width="20%" height="20%" style="margin:5px;"/>    
   		 		<img src="'.$pic2.'" width="20%" height="20%" style="margin:5px;" />
    			<img src="'.$pic3.'" width="20%" height="20%"style="margin:5px;"/> $ '.$price.' 
             </div>  
  				<div style="padding: 15px;">    
    			<P style="font-size: 12px; font-weight: normal;"> 
     			 '.	$ftt.'      
     				 </P>    
 				 </div>
  				<img src="image/images/carbot.gif" width="500" height="10" />
 			 </div></a>
  
	</div>';
  }
 }
  else {echo '<div id="commingsoon">

  <p>&nbsp;</p>
Comming Soon !
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>';}
?>

anyone to help me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.