Page 1 of 1

query issue

Posted: Fri Aug 31, 2007 11:57 am
by SirChick
Im getting this error with my script :

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\choosehousenumber.php on line 50


Not sure what i have to do to correct this how ever...
Any help is much appreciated!

This is the script:

Code: Select all

<?
$GetHouses = mysql_query("SELECT * FROM houses
							WHERE * ");
// Fetch the row from the database
if (!($gethousesrow = mysql_fetch_assoc($GetHouses))) {
    echo " Any number from 1 to 50!";
    }Else{
	
$num = array();
$query = mysql_query("SELECT HouseNumber FROM houses");
while($result = mysql_fetch_array($query)){
$num[] = $result['HouseNumber'];
}
foreach(range(1, 50) as $p){
if(!in_array($p, $num)){
echo $p." ";
}
}  
	
	
}					
?>

Posted: Fri Aug 31, 2007 1:21 pm
by feyd
I find your query suspect. mysql_error() may shed some light.*

* ***

Posted: Fri Aug 31, 2007 9:42 pm
by califdon
I don't think

Code: Select all

WHERE *
is valid SQL syntax. Where did you find that?