I have a site that is showing real estate listings... but if the results display "0" listings, the resulting page somehow jumps out of the drupal template...
Here is the working page with output:
http://sanluisrealestate.com/results
Here is the page that's jumped out:
http://sanluisrealestate.com/results?City=&Bedrooms=&Bathrooms=&Min=&Max...
And here is part of the code:
$colname2_recordset= "1";
if (isset($_GET['Bedrooms'])) {
$colname2_recordset= (get_magic_quotes_gpc()) ? $_GET['Bedrooms'] : addslashes($_GET['Bedrooms']);
}
$colname_recordset= "1";
if (isset($_GET['City'])) {
$colname_recordset= (get_magic_quotes_gpc()) ? $_GET['City'] : addslashes($_GET['City']);
}
mysql_select_db($database_mls_connection, $mls_connection);
$query_recordset= sprintf("SELECT * FROM res WHERE City = '%s' AND Bedrooms = '%s' ORDER BY Listing_Price ASC", $colname_recordset,$colname2_recordset);
$recordset= mysql_query($query_recordset, $mls_connection) or die(mysql_error());
$row_recordset= mysql_fetch_assoc($recordset);
$totalRows_recordset= mysql_num_rows($recordset);
$url3_recordset = "2";
if (isset($_GET['Bathrooms'])) {
$url3_recordset = (get_magic_quotes_gpc()) ? $_GET['Bathrooms'] : addslashes($_GET['Bathrooms']);
}
$url4_recordset = "0";
if (isset($_GET['Min'])) {
$url4_recordset = (get_magic_quotes_gpc()) ? $_GET['Min'] : addslashes($_GET['Min']);
}
$url5_recordset = "800000";
if (isset($_GET['Max'])) {
$url5_recordset = (get_magic_quotes_gpc()) ? $_GET['Max'] : addslashes($_GET['Max']);
}
$url1_recordset = "San Luis Obispo";
if (isset($_GET['City'])) {
$url1_recordset = (get_magic_quotes_gpc()) ? $_GET['City'] : addslashes($_GET['City']);
}
$url2_recordset = "3";
if (isset($_GET['Bedrooms'])) {
$url2_recordset = (get_magic_quotes_gpc()) ? $_GET['Bedrooms'] : addslashes($_GET['Bedrooms']);
}
mysql_select_db($database_mls_connection, $mls_connection);
$query_recordset = sprintf("SELECT * FROM res WHERE res.City = '%s' AND res.Bedrooms >= '%s' AND res.Total_Bathrooms >= '%s' AND res.Listing_Price >= '%s' AND res.Listing_Price <= '%s' ORDER BY res.Listing_Price DESC", $url1_recordset,$url2_recordset,$url3_recordset,$url4_recordset,$url5_recordset);
$recordset = mysql_query($query_recordset, $mls_connection) or die(mysql_error());
$row_recordset = mysql_fetch_assoc($recordset);
$totalRows_recordset = mysql_num_rows($recordset);
There are echo $totalRows_recordset
properties that match your search.
include 'includes/form_main.inc';
if($totalRows_recordset<=0)
{
print <<<EOM
defsfSA
</body>
</html>
EOM;
die();
}
do {
$path = '/mls/images/';
$number = $row_recordset['ML_Number'];
$not_available = $path.'not_available.png';
$filename = $path.$number.'.jpg';
$root_path = $_SERVER['DOCUMENT_ROOT'];
$filename = (is_readable($root_path.$filename)) ? $filename : $not_available;