Jump to content

[SOLVED] Query Page screws up my html


thefollower

Recommended Posts

I have an include with all the query's needed for the page but for some reason with the include in the page the page goes completely white and the layout screws up and just goes all over the place for no reason..... but if i take out the include php file its perfectly back to normal :S

 

can any one see what i got wrong, its never happened to me before so i don't know what i need to look for to fix it... no errors are produced either. heres my script:

 

<?

//first query to obtain house info from user
$GetHouseInfo = mysql_query("SELECT * FROM houses WHERE UserID='{$_SESSION['Current_User']}'") 
			or die(mysql_error());

// Fetch the row from the database
if (!($houserow = mysql_fetch_assoc($GetHouseInfo))) {
    echo "User not found!";
    exit;
}	

//second query to 
$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;
}
$HouseTotals = mysql_num_rows($GetHouses);

$GetHouseLodgers = mysql_query("SELECT * FROM userregistration , houses 
			   WHERE userregistration.HouseID = houses.HouseID")
			   or die(mysql_error());

$HouseLoderTotals = mysql_num_rows($GetHouseLodgers);
?>

Link to comment
Share on other sites

well, I had to re-write my code in a way that when an error occured, it would still 'fall-though' the script, instead of dying. or exiting.

 

E.G:

 

<?

//first query to obtain house info from user
if ($GetHouseInfo = mysql_query("SELECT * FROM houses WHERE UserID='{$_SESSION['Current_User']}'")) {

// Fetch the row from the database
if (($houserow = mysql_fetch_assoc($GetHouseInfo))) {

$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());

if (($gethouserow = mysql_fetch_assoc($GetHouses))) {

$HouseTotals = mysql_num_rows($GetHouses);

$GetHouseLodgers = mysql_query("SELECT * FROM userregistration , houses WHERE userregistration.HouseID = houses.HouseID") or die(mysql_error());

$HouseLoderTotals = mysql_num_rows($GetHouseLodgers);

} else {
echo "house not found";
}

} else {
echo "usr not found";
}

}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.