Query Problem[SOLVED]

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 Problem[SOLVED]

Post 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());
Last edited by SirChick on Fri Aug 24, 2007 10:54 am, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

I think there was an error message printed. Pretty sure.
SirChick
Forum Contributor
Posts: 125
Joined: Tue Jul 31, 2007 11:55 am

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

Post by feyd »

That would indicate no records were found.
SirChick
Forum Contributor
Posts: 125
Joined: Tue Jul 31, 2007 11:55 am

Post by SirChick »

yeah but there is deffinatly a row in everyone of them tables that matches up


i think i got it working now.
Post Reply