Paginate and alternate colors for rows?

I'm trying to Paginate this using php but I can't figure this for the life of me. Also I'm trying to make each row and alternate color as well. Can anyone help?
<?php

if ($_POST){

	$county = $_POST['county'];
	$rooms = $_POST['type'];
	$rent = $_POST['rent'];
	$rent_min = $rent - 500;
}
	
	$dbase = mysql_connect ( 'localhost', '', '' );
	mysql_select_db ( '', $dbase );
			
	if($county){
		$sql = "SELECT * FROM `` WHERE `county` = '".$county."' AND `rooms` = '".$rooms."' AND `rent` < '".$rent."' AND `rent` > '".$rent_min."' ";
	}else{
		$sql = "SELECT * FROM ``";
	}			
	
	$res = mysql_query($sql, $dbase);
	echo "<strong>Click Headers to Sort</strong>";
	echo "<table border='0' align='center' bgcolor='#999969' cellpadding='3' bordercolor='#000000'> 
<tr>
<th> Title </th> 
<th> County </th> 
<th> Town </th> 
<th> Phone </th> 
<th> Rooms </th> 
<th> Bath </th> 
<th> Rent </th>
</tr>";
				
		while($row = mysql_fetch_assoc($res))
				  {
echo "<tr>
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>
		   <a href='classified/searchapts/index.php?id=".$row['id']."'>" . $row['title'] . "</a></td>;
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['county'] . "</td> 
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['town'] . "</td> 
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['phone'] . "</td> 
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rooms'] . "</td> 
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['bath'] . "</td> 
		<td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rent'] . "</td>
</tr>"; 

}

echo "</table>"; 
			
	print_r($apts);


?>

Open in new window

genesisvhAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lukasz ChmielewskiCommented:
For the alternate row colors, use

$i=0;
while($row = mysql_fetch_assoc($res))
 {
 if(($i%2) == 0) $col = "#ffffff"; else $col = "#efefef";
echo "<tr>
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>
		   <a href='classified/searchapts/index.php?id=".$row['id']."'>" . $row['title'] . "</a></td>;
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>" . $row['county'] . "</td> 
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>" . $row['town'] . "</td> 
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>" . $row['phone'] . "</td> 
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>" . $row['rooms'] . "</td> 
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>" . $row['bath'] . "</td> 
		<td bgcolor='<?php echo"$col";?>' style='color: #000' align='center'>" . $row['rent'] . "</td>
</tr>"; 
$i++;
}

Open in new window

hexer4uCommented:
Attached you have your answer.
You might need to change some stuff, and fix errors, but basically this is all you need index.php
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

hexer4uCommented:
Oh, forgot the colouring, but Roads sollution works with mine

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
genesisvhAuthor Commented:
Thanks guys but Hexer4u had the best solution thanks!
genesisvhAuthor Commented:
Just a quick question but what do I put in these fields
$where = '';
$get = '';
hexer4uCommented:
Nothing. Leave them be. They are default values that specify what should the query search for when nothing is specified. It basically means everything.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.