I simplified this as much as possible. I got the key php code from one of the guru responses under a past forum help posting. The crux of the matter is this: I can't resolve an Error when using a variable or SESSION var to store a sql string: the error is... "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource". If I place the actual sql text string in the mysql_query() function, it gives the $result object and outputs from the database fine. But, when I save the string into a var, and add that to the sql string, wholaaa! the error. One of the gurus has to know the answer to this. Code follows: [code] <?php session_start(); include('includes/admin_functions.php'); //This is the code from one of the gurus: $_SESSION['schooldist'] = $_GET['schooldist']; $_SESSION['bedrooms'] = $_GET['bedrooms']; $_SESSION['baths'] = $_GET['baths']; //Create array to hold search parameters //Keep it simple just include one for now $LookFor = Array('schooldist', 'bedrooms', 'baths'); // See if the session variable name is in the array $LookFor // Make sure the variable is not empty // Add a match to a new array called $matches foreach ($_SESSION as $key => $SessionVar) { if ((in_array($key, $LookFor)) && ($SessionVar != '')) { $matches[] = $key . ' = \'$_SESSION['.$key.']\''; } } // Join the matches with the word "AND" so this can be used as part of a query // add later with more search params ... $where = implode(' AND ', $matches); // Test to see if we are getting what is expected print_r($where); // Outputs schooldist = '$_SESSION[schooldist]' AND bedrooms = '$_SESSION[bedrooms]' AND baths = '$_SESSION[baths]' // so far, so good... thank you guru! but it soon breaks when you run it in the query... db_connect(); $result = mysql_query("select * from PROPERTY '".$where."';"); //ERROR!!! Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in search_results.php on line 72 while( $row = mysql_fetch_array($result) ) { $vschooldist = $row['schooldist']; print("<table><tr><td width='100' align='center'>$vschooldist</td></tr></table> "); } ?> [/code]