query issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SirChick
Forum Contributor
Posts: 125
Joined: Tue Jul 31, 2007 11:55 am

query issue

Post 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." ";
}
}  
	
	
}					
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I find your query suspect. mysql_error() may shed some light.*

* ***
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

I don't think

Code: Select all

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