Help? No results returning need to add loop inside loop?

http://www.nationalautoliquidators.com/used_cars/mk-Acura/md-CL/st-Alaska/ct-Chefornak/

Say someone enters the site from an chevy silverado chefornak alaska and in my feed i do not have a chevy silverado in chefornak alaska so they come to a blank page.

Im thinking that i could put a loop inside a loop like run through the Database if 0 results return go back and increase the radius for 200 miles. I cant figure it out for the life of me, and then the mod-rewrite thing i get confused on what page im even on.

[php]<?php
include (“inc/config.php”) ;

$State = str_replace(array("_","-"),array(" ", " "),$_GET['State']);
$City = str_replace(array("_","-"),array(" "," "),$_GET['City']);
$Make = str_replace(array("_"),array(" "),$_GET['Make']);
$Model = str_replace(array("_"),array(" "),$_GET['Model']);
$dashState=str_replace(array(" "),array("_"),$State);
$dashCity=str_replace(array(" "),array("_"),$City);
$dashModel=str_replace(array(" "),array("_"),$Model);

$logoTag = 'Used Cars for Sale';
$metaTitle = 'Used '.$Make.' '.$Model.' for Sale in '.$City.', '.$State.'';
$metaDesc = ''.$Make.' '.$Model.' '.$City.' Find '.$Make.' '.$Model.' in '.$City.', '.$State.'';
$metaKeywords = ''.$Model.','.$Make.' '.$Model.', '.$City.'. '.$State.' used cars, buy, search, find, buying';

// Turn ads on or off
$ad160600 = ‘ON’; $ad180150 = ‘OFF’; $ad72890 = ‘ON’;

// Turn Sections on or off
$bigbox = ‘OFF’;

include ("inc/meta-head.php") ;

// Find a zip code for used cars
$zipQuery = "
SELECT zipZipCode
FROM Jess_City, ace_state, ace_city, ace_zip
WHERE Jess_City.city_name = ace_city.city_name
AND Jess_City.st_name = ace_state.st_name
AND city_id = zipCityID
AND st_id = zipStateID
AND Jess_City.st_name = ‘$State’
AND Jess_City.city_name = ‘$City’
ORDER BY Jess_City.count DESC
LIMIT 1;
;
";
42450
$zipRow = mysql_query($zipQuery);
$zipQ = mysql_fetch_assoc($zipRow);
$zipcode = $zipQ[“zipZipCode”];

// Used car feed info for LotPro.com
$make = $_POST[‘make’];
$model = $_POST[‘model’];
$price = $_POST[‘price’];
$radius = $_POST[‘radius’];
$showCars = $_POST[‘showCars’];
$sZip = $_POST[‘sZip’];

if($price==""){$price="99999";}
if($radius==""){$radius="100";}
if($showCars==""){$showCars = 16;}
if($make==""){$make="$Make";}
if($model==""){$model="$Model";}
if($sZip!=""){$fZip=$sZip;}else{$fZip="$zipcode";}

?>

<?=$logoTag?>

<?php /* DO NOT DELETE THE FOLLOWING DIV */ ?>
<?php include ("inc/nav-top.php") ;?>
	<?php if ($bigbox == 'ON') include ("inc/nav-headerbox.php") ;?>

	<div id="wrapper"><div class="wrapper-top-left"><div class="wrapper-top-right"><div class="wrapper-bottom-left"><div class="wrapper-bottom-right"><div class="width">

	<div id="right">
		<?php include ("inc/nav-menubox.php") ;?>
	</div>
	<div style="margin: 10px 0 10px 15px;">
	<h1><?php echo"".$Make." ".$Model." Model Years";?></h1>
<?php $sql = " SELECT DISTINCT divID,divName, modelName, modelYear FROM chrome_divisions, chrome_models WHERE modelDivID = divID AND modelYear <> 2011 AND divName = '$Make' AND modelName = '$Model' AND divID NOT IN (45,51,56,57) Order By modelYear DESC; "; $result = mysql_query($sql); // Insert your Query here $Go = TRUE; // Put the code to start the HTML table here echo "\n"; while ($Go) { // Here you put the code to start a new row in the HTML table echo " \n"; // Now, move through each column of the current row. for ($i = 0; $i < 1; $i ++) { // Dont forget to put an "if" clause in here in case you reach the end of the rows returned by the database // Also, this line will take care of moving to the next entry in the database. if (!($row = mysql_fetch_array($result))) { $Go = FALSE; CONTINUE; } // Edit this line to modify what each cell looks like. $MakeC = $row['divName']; $ModelC = $row['modelName']; $YearC = $row['modelYear']; $dashState=str_replace(array(" "),array("_"),$State); $dashCity=str_replace(array(" "),array("_"),$City); $dashMake=str_replace(array(" "),array("_"),$MakeC); $dashModel=str_replace(array(" "),array("_"),$ModelC); echo ""; } // Put the code to end the current row here echo " \n"; } // Code to end the HTML table goes here echo "
$YearC $MakeC $ModelC
"; unset ($CurrentLine); unset ($Go); ?> <?php echo "$MakeC $ModelC";?>
		<?php include ("ads/ad180150.php") ;?>
		<?php include ("ads/ad160600.php") ;?>
	<div class="module"><div class="first"><div class="sec"></div>
			<h3><span>Event Conditions</span></h3>
			<div class="box-indent">
				<div class="width">
					No Dealers Or Wholesalers Allowed.Until The Close Of Business On The Last Day Of The Liquidation Event.<br /><br />
					No Over Night Camping Permitted!<br /><br />
					Be Prepared To Take Immediate Delivery!y

				</div></div></div></div>
	<div class="module-banner2"></div></div>
	<div class="container">
	<div class="width2">

	<table class="blog" cellpadding="0" cellspacing="0">
		<tbody>
			<tr>
				<td valign="top"><div class="border-left"><div class="border-right"><div class="border-top"><div class="border-bottom"><div class="corner-top-left"><div class="corner-top-right"><div class="corner-bottom-left"><div class="corner-bottom-right"><div class="width"><div><div class="title-top"><div class="title-bottom"><div class="title-top-left"><div class="title-top-right"><div class="title-bottom-left"><div class="title-bottom-right"><div class="width">

				<table class="contentpaneopen">
					<tbody>
						<tr>
							<td class="contentheading" width="100%">
							<?php echo $City;?> Used <?php echo $Make;?> Cars For Sale</td>
						</tr>
					</tbody>
				</table></div></div></div></div></div></div></div>

	<div class="article-indent"><div class="width">
		<table class="contentpaneopen">
			<tbody>
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" valign="top">
						<div class="bcrumb">
						<a href="<?php echo"$webPath";?>">Autos</a> &gt;
						<a href="<?php echo"$webPath";?>used_cars/">Used Cars</a> &gt;
						<a href="<?php echo"$webPath";?>used_cars/st_<?php echo"$dashState"?>/"><?php echo"$State" ;?></a> &gt;
						<a href="<?php echo"$webPath";?>used_cars/s_<?php echo"$dashState"?>/ct_<?php echo"$dashCity" ;?>/"><?php echo"$City" ;?></a> &gt;
						<a href="<?php echo"$webPath";?>used_cars/s-<?php echo"$dashState";?>/c-<?php echo"$dashCity";?>/m-<?php echo"$dashMake";?>/"><?php echo"$Make" ;?></a> &gt;
						<?php echo"$Model" ;?>
						</div>
						<div>
						<?php include("feeds/filter.php");?>
						</div>
						</p>
					</td>
				</tr>

			</tbody>
		</table></div></div>

	<table class="blog" cellpadding="0" cellspacing="0">
		<tbody>
			<tr>
				<td valign="top"><div class="border-left"><div class="border-right"><div class="border-top"><div class="border-bottom"><div class="corner-top-left"><div class="corner-top-right"><div class="corner-bottom-left"><div class="corner-bottom-right"><div class="width"><div><div class="title-top"><div class="title-bottom"><div class="title-top-left"><div class="title-top-right"><div class="title-bottom-left"><div class="title-bottom-right"><div class="width">

				<table class="contentpaneopen">
					<tbody>
						<tr>
							<td class="contentheading" width="100%">
							Find a Used <?php echo $Make;?> <?php echo $Model;?> For Sale near <?php echo $City ;?></td>
						</tr>
					</tbody>
				</table></div></div></div></div></div></div></div>

	<div class="article-indent"><div class="width">
		<table class="contentpaneopen">
			<tbody>
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" valign="top">
					<?php include("feeds/lastUpdated.php");?>
					<?php include("feeds/rss3html-filter.php");?>
					</td>
				</tr>

			</tbody>
		</table></div></div>

			<span class="article_separator">&nbsp;</span>
			</div></div></div></div></div></div></div></div></div></div>
		</td>
	</tr>

	<tr>
		<td valign="top">
			<table cellpadding="0" cellspacing="0" width="100%">
				<tbody>
					<tr>
						<td class="article_column" valign="top" width="100%"><div class="border-left"><div class="border-right"><div class="border-top"><div class="border-bottom"><div class="corner-top-left"><div class="corner-top-right"><div class="corner-bottom-left"><div class="corner-bottom-right"><div class="width"><div class="title-top"><div class="title-bottom"><div class="title-top-left"><div class="title-top-right"><div class="title-bottom-left"><div class="title-bottom-right"><div class="width">
						<table class="contentpaneopen">
							<tbody>
							<tr>
								<td class="contentheading" width="100%">
									<?php echo $City;?> Used Cars for Sale By <?php echo $Make;?> Model
								</td>
							</tr>
							</tbody>
						</table></div></div></div></div></div></div></div>

		<div class="article-indent"><div class="width">
		<table class="contentpaneopen">
			<tbody>
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" valign="top">
<?php $sql = " SELECT DISTINCT divID,divName, modelName FROM chrome_divisions, chrome_models WHERE modelDivID = divID AND modelYear <> 2011 AND divName = '$Make' AND modelName NOT LIKE '%chassis%' AND modelName NOT Like '%classic%' AND modelName NOT LIKE '%cutaway%' AND modelName NOT LIKE '%standard%' AND modelName NOT LIKE '%DRW%' AND modelName NOT LIKE '%SRW%' AND modelName NOT LIKE '%motorhome%' AND modelName NOT LIKE '%work%' AND divID NOT IN (45,51,56,57) Order By modelName ASC; "; $result = mysql_query($sql); // Insert your Query here $Go = TRUE; // Put the code to start the HTML table here echo "\n"; while ($Go) { // Here you put the code to start a new row in the HTML table echo " \n"; // Now, move through each column of the current row. for ($i = 0; $i < 4; $i ++) { // Dont forget to put an "if" clause in here in case you reach the end of the rows returned by the database // Also, this line will take care of moving to the next entry in the database. if (!($row = mysql_fetch_array($result))) { $Go = FALSE; CONTINUE; } // Edit this line to modify what each cell looks like. $MakeC = $row['divName']; $ModelC = $row['modelName']; $dashState=str_replace(array(" "),array("_"),$State); $dashCity=str_replace(array(" "),array("_"),$City); $dashMakeC=str_replace(array(" "),array("_"),$MakeC); $dashModelC=str_replace(array(" "),array("_"),$ModelC); echo ""; } // Put the code to end the current row here echo " \n"; } // Code to end the HTML table goes here echo "
$MakeC $ModelC
"; unset ($CurrentLine); unset ($Go); ?>
	 </tbody>
		 </table><div></div>

		</td>
		</tr>
	</tbody>
	</table></div></div>

			</div></div></div></div></div></div></div></div></div></div>
		</td>
	</tr>
	<tr>
		<td valign="top">
			<table cellpadding="0" cellspacing="0" width="100%">
				<tbody>
					<tr>
						<td class="article_column" valign="top" width="100%"><div class="border-left"><div class="border-right"><div class="border-top"><div class="border-bottom"><div class="corner-top-left"><div class="corner-top-right"><div class="corner-bottom-left"><div class="corner-bottom-right"><div class="width"><div class="title-top"><div class="title-bottom"><div class="title-top-left"><div class="title-top-right"><div class="title-bottom-left"><div class="title-bottom-right"><div class="width">
						<table class="contentpaneopen">
							<tbody>
							<tr>
								<td class="contentheading" width="100%">
									Used <?php echo $Make;?> <?php echo $Model;?>s for Sale in Other <?php echo $State;?> Cities
								</td>
							</tr>
							</tbody>
						</table></div></div></div></div></div></div></div>

		<div class="article-indent"><div class="width">
		<table class="contentpaneopen">
			<tbody>
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" valign="top">
<?php $sql = " SELECT city_name, st_name FROM Jess_City WHERE st_name = '$State' ORDER BY city_name ASC LIMIT 50 ; ; "; $result = mysql_query($sql); // Insert your Query here $Go = TRUE; // Put the code to start the HTML table here echo "\n"; while ($Go) { // Here you put the code to start a new row in the HTML table echo " \n"; // Now, move through each column of the current row. for ($i = 0; $i < 4; $i ++) { // Dont forget to put an "if" clause in here in case you reach the end of the rows returned by the database // Also, this line will take care of moving to the next entry in the database. if (!($row = mysql_fetch_array($result))) { $Go = FALSE; CONTINUE; } // Edit this line to modify what each cell looks like. $State = $row["st_name"]; $CityA = $row["city_name"]; $dashState=str_replace(array(" "),array("_"),$State); $dashCityA=str_replace(array(" "),array("_"),$CityA); $dashMake=str_replace(array(" "),array("_"),$Make); $dashModel=str_replace(array(" "),array("_"),$Model); echo ""; } // Put the code to end the current row here echo " \n"; } // Code to end the HTML table goes here echo "
$CityA
"; unset ($CurrentLine); unset ($Go); ?>
					</td>
				 </tr>
			 </tbody>
		 </table><div></div>

		</td>
		</tr>
	</tbody>
	</table></div></div>

	<span class="article_separator">&nbsp;</span></div></div></div></div></div></div></div></div></div>
		</td>
		</tr>
		</tbody>
		</table>
		</td>
		</tr>
		</tbody>
	</table></div></div></div></div></div></div></div></div>
	</div>
	<span class="article_separator">&nbsp;</span>
		<?php include ("ads/ad72890.php") ;?>

		<?php include ("inc/footer.php") ;?>
[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service