hybmg57 Posted June 25, 2010 Share Posted June 25, 2010 Hi, I'm getting this error, Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\MLS Search Form\Search Results.php on line 116 I have done search under Search form which has correct values but it seems like when I enter WHEN and AND functions in mysql query I get this error. Please help me!!! Below is my code... Thank you. Jae <?php if (is_numeric($_GET['pg'])) { $pgnum = ((int) $_GET['pg']); } else { $pgnum = 0; $errorMessage = "Invalid value for page number"; } $startnum = 0; $nextpg = ($pgnum + 1); $prevpg = ($pgnum-1); if ($pgnum > 0) { $offset = ($pgnum * 19); } else { $offset = 0; } $limit = 20; ?> <?php $Property_Type=$_GET['property_type']; $City=$_GET['city']; $Beds=$_GET['beds']; $Baths=$_GET['baths']; $Lowest_Price=$_GET['lowest_price']; $Highest_Price=$_GET['highest_price']; echo $Property_Type.", "; echo $City.", "; echo $Beds.", "; echo $Baths.", "; echo $Lowest_Price.", "; echo $Highest_Price.", "; include("db.php"); ?> <body id="www-rogers-healy-com" class="our-listings our-listings-landing" text> <div id="page"> <div id="content-container"> <div id="content" class="clearfix"> <div id="container"> <div id="listings-container"> <div id="listings"> <?php $rets_login_url = "http://ntreisrets.mls.ntreis.net:80/rets/login"; $rets_username = "(Username entered)"; $rets_password = "(Password entered)"; $rets_agent = "(Agent)"; require_once('phRets.php'); $rets = new phRets; $connect = $rets->Connect($rets_login_url, $rets_username, $rets_password); if (!$connect) { print_r($rets->Error()); } $result = mysql_query("SELECT * FROM residential WHERE 'PROPSUBTYPE' AND 'SUBDIVISION' LIKE '{$City}' AND 'BEDS' >={$Beds} AND 'BATHSTOTAL' >={$Baths} AND 'LISTPRICE' >={$Lowest_Price} AND 'LiSTPRICE' <={$Highest_Price} LIMIT {$offset}, {$limit}"); ?> <div id="rha-mls-pager-container"> <?php if ($pgnum > 0) { echo("<a href='Search Results.php?pg=" . $prevpg . "'><< Previous page</a> "); } if ($pgnum > 0) { echo("<a href='Search Results.php?pg=" . $nextpg . "'>Next page >></a> "); } mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM residential LIMIT {$limit}"); $total_rows = mysql_query("SELECT FOUND_ROWS()"); $total_found = mysql_fetch_array($total_rows); echo $total_found[0]." results found"; ?> </div><!--/#rha-mls-pager-container--> <br/> <?php echo $found_results; while ($row = mysql_fetch_array($result)){ echo "<div class=\"vcard listing\">"; echo "<div class=\"information\">"; echo "<span style=\"size:20px\">\$".number_format($row['LISTPRICE'])."\n </span><br/>"; echo "<p><span>{$row['STREETNUM']},{$row['STREETNAME']} "; echo "<BR/>{$row['CITY']}</span>"; echo "{$row['STATE']}, {$row['ZIPCODE']}</p>"; echo "<p><span>Beds: {$row['BEDS']}, Baths:{$row['BATHSTOTAL']}<br/>Square Feet: ".number_format($row['SQFTTOTAL'])." </span></p>"; echo "</div>"; $photos = $rets->GetObject("Property", "Thumbnail", "{$row['MLSNUM']}", "0", 1); foreach ($photos as $photo) { $listing = $photo['Content-ID']; $number = $photo['Object-ID']; if ($photo['Success'] == true) { echo "<img src='{$photo['Location']}\n' alt=\"\" title=\"\" class=\"listing-photo photo\" width=\"146\" height=\"107\" />"; } else { echo "<img src='images/no-image.png' alt=\"\" title=\"\" class=\"listing-photo photo\" width=\"146\" height=\"107\" />"; } } echo "<a href=\"#\" class=\"button url\">See Property Details</a>"; echo "</div>"; } ?> Link to comment https://forums.phpfreaks.com/topic/205887-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 25, 2010 Share Posted June 25, 2010 Please only start one thread for any problem - http://www.phpfreaks.com/forums/index.php/topic,302302.0.html Link to comment https://forums.phpfreaks.com/topic/205887-warning-mysql_fetch_array-expects-parameter-1-to-be-resource-boolean-given/#findComment-1077413 Share on other sites More sharing options...
Recommended Posts