"; if ($num_rows == "1") {Print "There is currently one listing in this category.
";} else {Print "There are currently $num_rows listings in this category.
";} print " "; if ($total_num_page != 0) { Print "This is page $page_num of $total_num_page. Displaying $listings_per_page listings per page.
"; $prevpage = $cur_page-1; $nextpage = $cur_page+1; if ($page_num != 1){print "Previous Page ";} if ($page_num != $total_num_page){print " Next Page ";} } if ($total_num_page > 1) { print "
"; Print ""; Print "
"; } print "

"; //handle sort functions print "[ Sort by: "; print "  "; if ($sort == "id DESC") {print "Most Recent";} else {print "Most Recent";} print "  "; if ($sort == "make ASC") {print "Make";} else {print "Make";} if ($use_city_state == "Y") { print "  "; if ($sort == "city") {print "Model";} else {print "Model";} } print "  "; if ($sort == "year DESC") {print "Year";} else {print "Year";} print "  "; if ($sort == "miles ASC") {print "Km.";} else {print "Km.";} print "  "; if ($sort == "price DESC") {print "Price";} else {print "Price";} print " ]

"; //end sort functions $limit_str = "LIMIT ". $cur_page * $listings_per_page .",$listings_per_page"; $query = "$querystring $limit_str"; $result = mysql_query("$query;",$link); print ""; print ""; print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; print ""; print ""; print ""; print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; print ""; print ""; print ""; print ""; while ($a_row =mysql_fetch_array ($result) ) { //strip slashes so input appears correctly $a_row[$title] = stripslashes($a_row[$title]); $a_row[$address] = stripslashes($a_row[$address]); $a_row[city] = stripslashes($a_row[city]); $a_row[previewdesc] = stripslashes($a_row[previewdesc]); $a_row[fulldesc] = stripslashes($a_row[fulldesc]); $a_row[type] = stripslashes($a_row[type]); $a_row[transmission] = stripslashes($a_row[transmission]); $a_row[color] = stripslashes($a_row[color]); $a_row[doors] = stripslashes($a_row[doors]); $a_row[stereo] = stripslashes($a_row[stereo]); $a_row[notes] = stripslashes($a_row[notes]); $a_row[movtag] = stripslashes($a_row[movtag]); //format price & miles $a_row[price] = number_format ($a_row[price]); $a_row[miles] = number_format ($a_row[miles]); print ""; //select images connected to a given listing $query = "SELECT * FROM tbl_Files WHERE prop_num = $a_row[id] order by description LIMIT 1"; $output = mysql_query("$query",$link); $count = 0; while ($image_row =mysql_fetch_array ($output) ) { print ""; $count++; } if ($count == 0) { print ""; } print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; if ($a_row[price] == 0) { print ""; print ""; print ""; print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; print ""; print ""; print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; print ""; print ""; print ""; print ""; print ""; if ($use_city_state == "Y") {print "";} print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; } print "
ListingMakeModelYearKm.FOB PriceStatus
\"Photo\"
\"View
$a_row[make]$a_row[city], $a_row[model]$a_row[body] $a_row[year]$a_row[miles]ASK"; } else print "USD $a_row[price]$a_row[stereo]
# $a_row[id] Details ...
"; if ($total_num_page > 1) { print "

"; Print ""; Print "
"; } if ($total_num_page != 0) { print "

"; $prevpage = $cur_page-1; $nextpage = $cur_page+1; if ($page_num != 1){print "Previous Page ";} if ($page_num != $total_num_page){print " Next Page ";} } Print "

"; } print "\r\n"; include("./templates/minitruck_top.html"); print "\r\n\r\n\r\n"; //BE CAREFUL IN HERE IF YOU DON'T KNOW WHAT YOU'RE DOING if ($cur_page == "") {$cur_page = 0;} //SELECT A SPECIFIC PROPERTY if ($view != "") { $query = "SELECT * FROM vehicles WHERE id='$view'"; $result = mysql_query($query); if (!$result) error_message (sql_error()); //strip slashes so input appears correctly $a_row = mysql_fetch_array($result); $a_row[$title] = stripslashes($a_row[$title]); $a_row[$address] = stripslashes($a_row[$address]); $a_row[city] = stripslashes($a_row[city]); $a_row[previewdesc] = stripslashes($a_row[previewdesc]); $a_row[fulldesc] = stripslashes($a_row[fulldesc]); $a_row[type] = stripslashes($a_row[type]); $a_row[transmission] = stripslashes($a_row[transmission]); $a_row[color] = stripslashes($a_row[color]); $a_row[doors] = stripslashes($a_row[doors]); $a_row[stereo] = stripslashes($a_row[stereo]); $a_row[notes] = stripslashes($a_row[notes]); $a_row[movtag] = stripslashes($a_row[movtag]); //format price & miles $a_row[price] = number_format ($a_row[price]); $a_row[miles] = number_format ($a_row[miles]); //print out the listing itself Print ""; Print ""; Print "
Listing : $a_row[title]

"; Print "
"; //is there an image? //select images connected to a given listing $count = 0; $query = "SELECT * FROM tbl_Files WHERE prop_num = $a_row[id] order by description"; $result = mysql_query("$query",$link); while ($image_row =mysql_fetch_array ($result) ) { echo ""; echo stripslashes($image_row[description]) . "
\n"; echo "
Click to Enlarge
"; echo "

\n"; $count++; } print ""; if ($count == 0) { print "
"; } elseif ($count == 1) { print "Click photo to enlarge

"; } else { print "Click photos to enlarge

"; } Print "

"; print "$a_row[movtag]"; print "Make: $a_row[make]
"; Print "Model: $a_row[city]
"; Print "Model #: $a_row[model]
"; print "Year: $a_row[body] $a_row[year]
"; print ""; print ""; print ""; print ""; print ""; print "

"; print ""; if ($friendmail == "Y") { Print ""; Print ""; } Print "
"; print "
"; if ($a_row[price] == 0) {Print "Price: ASK
"; } else Print "Price: USD $a_row[price]
"; Print "Km: $a_row[miles]
"; Print "Color: $a_row[color]
"; Print "Type: $a_row[type]
"; print "Doors: $a_row[doors]
"; print "Capacity: $a_row[capacity]
"; print "Gear: $a_row[transmission]
"; print "Drive: $a_row[drivetrain]

"; print "
"; print "Engine: $a_row[zip]
"; print "Displacement CC: $a_row[displacement]
"; print "Grade: $a_row[state]
"; print "Status: $a_row[stereo]

"; print "
Features:"; //deal with features $featuresarray = explode("||", $vehiclefeatureoptions); while (list($IndexValue, $FeatureItem) = each ($featuresarray)) { $realindex = $IndexValue+1; $optnum = "opt".$realindex; if ($a_row[$optnum] == 'Y') {print "$FeatureItem
";} } print "
$a_row[fulldesc]
Inventory Inquiry: 
(English Only)
Click here to inquire about this car
"; } else //if it's not a single listing, just what is it you'd like to see? { //set up minimum and maximum price if ($minprice == "") { $minprice = 0; } if ($maxprice == "") { $maxprice = 1000000000000000; } //get rid of extra junk in min and max price $minprice = ereg_replace("%24","",$minprice); $maxprice = ereg_replace("%24","",$maxprice); $minprice = ereg_replace("%2C","",$minprice); $maxprice = ereg_replace("%2C","",$maxprice); $minprice = ereg_replace("[^[:alnum:]]","",$minprice); $maxprice = ereg_replace("[^[:alnum:]]","",$maxprice); //start building querystring and guidestring //the querystring is the mySQL query itself, while //guidestring is the actual url of the search -- it's used //to pass along data so you can jump to different pages easily $querystring = "SELECT * FROM vehicles WHERE "; $querystring = $querystring."(price >= '$minprice' AND price <= '$maxprice')"; $guidestring = "minprice=$minprice&maxprice=$maxprice"; foreach ($HTTP_GET_VARS as $key=>$value) { if ($key == "citystate") { $count = 0; $extra = ""; $querystring = $querystring." AND ("; foreach ($value as $two_dim_value) { //deal with city and state selection //break apart city and state $guidestring = $guidestring."&citystate%5B%5D=$two_dim_value"; $buffer = explode("___" , $two_dim_value); $city = $buffer[0]; $state = $buffer[1]; if ($count > 0) {$extra = " OR ";} $querystring = $querystring."$extra(city='$city' and state='$state')"; $count++; } $querystring = $querystring.")"; } elseif ($key == "makemodelchoice") { $count = 0; $extra = ""; $querystring = $querystring." AND ("; foreach ($value as $two_dim_value) { //deal with make and model selection //break apart make and model $guidestring = $guidestring."&makemodelchoice%5B%5D=$two_dim_value"; $buffer = explode("___" , $two_dim_value); $make = $buffer[0]; $model = $buffer[1]; if ($count > 0) {$extra = " OR ";} $querystring = $querystring."$extra(make='$make' and model='$model')"; $count++; } $querystring = $querystring.")"; } elseif ($key == "minprice") { //do not do anything further -- already handled } elseif ($key == "maxprice") { //do not do anything further -- already handled } elseif ($key == "typechoice") { $count = 0; $extra = ""; $querystring = $querystring." AND ("; foreach ($value as $two_dim_value) { $guidestring = $guidestring."&typechoice%5B%5D=$two_dim_value"; if ($count > 0) {$extra = " OR ";} $querystring = $querystring."$extra(type='$two_dim_value')"; $count++; } $querystring = $querystring.")"; } elseif ($key == "makechoice") { $count = 0; $extra = ""; $querystring = $querystring." AND ("; foreach ($value as $two_dim_value) { $guidestring = $guidestring."&makechoice%5B%5D=$two_dim_value"; if ($count > 0) {$extra = " OR ";} $querystring = $querystring."$extra(make='$two_dim_value')"; $count++; } $querystring = $querystring.")"; } elseif ($key == "transmissionchoice") { $count = 0; $extra = ""; $querystring = $querystring." AND ("; foreach ($value as $two_dim_value) { $guidestring = $guidestring."&transmissionchoice%5B%5D=$two_dim_value"; if ($count > 0) {$extra = " OR ";} $querystring = $querystring."$extra(transmission='$two_dim_value')"; $count++; } $querystring = $querystring.")"; } elseif ($key == "cur_page") { //do nothing -- dealt with elsewhere } elseif ($key == "sort") { //handle the way the page sorts data //do nothing now -- dealt with elsewhere } else { $guidestring = $guidestring."&$key=$value"; $querystring = $querystring." AND $key = '$value'"; } } //remove the comment marks below if you want help diagnosing problems //or want to view the actual strings being passed to mySQL //print "$querystring
"; //print "$guidestring
"; makelisting($querystring, $link, $guidestring, $cur_page, $listings_per_page, $sort); } //print the footer print"\r\n\r\n"; include("./templates/user_bottom.html"); //gots to close the mysql connection mysql_close($link); ?>