Page 1 of 1

Query Problem[SOLVED]

Posted: Fri Aug 24, 2007 9:54 am
by SirChick
I have a problem with my query, i must have some structure wrong here but i cannot see where i have gone wrong... can any one see where i have gone wrong ?

Code: Select all

$GetHouses = mysql_query("SELECT houses.*, cities.*, countries.* FROM houses, cities, countries
WHERE houses.userID ='{$_SESSION['Current_User']}' AND cities.cityID = houses.cityID AND cities.countryID = countries.countryID.")
or die(mysql_error());

Posted: Fri Aug 24, 2007 10:11 am
by volka
I think there was an error message printed. Pretty sure.

Posted: Fri Aug 24, 2007 10:25 am
by SirChick
i managed to get it fix (kinda).


i changed it to this:

Code: Select all

$GetHouses = mysql_query("SELECT houses.*, cities.*, countries.* FROM houses, cities, countries 
			WHERE houses.UserID ='{$_SESSION['Current_User']}' AND cities.CityID = houses.CityID AND cities.CountryID = countries.CountryID")
			or die(mysql_error());
// Fetch the row from the database
if (!($gethouserow = mysql_fetch_assoc($GetHouses))) {
    echo "Houses Not found!";
    exit;
}
and got this in return:

"Houses Not found!"

Not sure what to do from here

Posted: Fri Aug 24, 2007 10:40 am
by feyd
That would indicate no records were found.

Posted: Fri Aug 24, 2007 10:49 am
by SirChick
yeah but there is deffinatly a row in everyone of them tables that matches up


i think i got it working now.