"; 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 == "price DESC") {print "Price";} else {print "Price";} print "  "; if ($sort == "id DESC") {print "Most Recent";} else {print "Most Recent";} print "  "; if ($sort == "miles DESC") {print "Mileage";} else {print "Mileage";} print "  "; if ($sort == "year DESC") {print "Year";} else {print "Year";} if ($use_city_state == "Y") { print "  "; if ($sort == "city") {print "City";} else {print "City";} } 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 ""; 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 ""; 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]); //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] LIMIT 1"; $output = mysql_query("$query",$link); $count = 0; while ($image_row =mysql_fetch_array ($output) ) { print ""; $count++; } if ($count == 0) { 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 ""; 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 "
ListingCityMakeModelMilesAsking Price
\"Photo\"
\"View
$a_row[city], $a_row[state]$a_row[make]$a_row[year] $a_row[model]$a_row[miles]\$$a_row[price]
Listing: $a_row[id] See listing...
"; 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/user_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]); //format price & miles $a_row[price] = number_format ($a_row[price]); $a_row[miles] = number_format ($a_row[miles]); // added 28 Nov 2002 MCR // Pull up seller's email address. // vehicles.agent is text and vehicles.owner is id, both of // which can be looked up in agents. For real estate, agent // and owner can be different, but for cars, they should be // the same. Use vehicles.owner as the key for now. // Future: Combine this with the query above. $query = "SELECT * FROM agents WHERE id='$a_row[owner]'"; $result = mysql_query($query); if (!$result) error_message (sql_error()); //strip slashes so input appears correctly $b_row = mysql_fetch_array($result); $b_row[$agentemail] = stripslashes($a_row[$agentemail]); // added 28 Nov 2002 MCR //print out the listing itself Print ""; Print ""; Print "
Listing : $a_row[title]

"; Print ""; Print ""; Print ""; 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]"; $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 ""; print ""; print ""; print ""; print ""; print "

"; print ""; if ($friendmail == "Y") { Print ""; Print ""; } // added 28 Nov 2002 MCR // uncommented 12-10-02 dsr, prevents table from closing. Print "
"; print "Make: $a_row[make]
"; Print "Model: $a_row[model]
"; print "Year: $a_row[year]
"; Print "Condition: $a_row[body]"; print "
"; Print "Price: \$$a_row[price]
"; Print "Mileage: $a_row[miles]
"; Print "Color: $a_row[color]
"; Print "Type: $a_row[type]
"; print "Doors: $a_row[doors]
"; print "Transmission: $a_row[transmission]
"; print "Drivetrain: $a_row[drivetrain]
"; print "Stereo: $a_row[stereo]

"; print "

"; //is the $use_city_state option selected? if ($use_city_state == "Y") { Print "
City: $a_row[city]
State: $a_row[state]
Zip: $a_row[zip]
"; } 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]
Send to a Friend: Click Here to email this listing
"; Print "
Seller contact:$b_row[agentemail]
"; // added 28 Nov 2002 MCR } 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 == "yearchoice") { $count = 0; $extra = ""; $querystring = $querystring." AND ("; foreach ($value as $year) { //deal with year selection //break apart make and model $guidestring = $guidestring."&yearchoice%5B%5D=$year"; if ($count > 0) {$extra = " OR ";} $querystring = $querystring."$extra(year='$year')"; $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); ?>