Jump to content

Recommended Posts

I have two queries searching for UserID on two tables... but it wont echo my second query.. the first one works how ever even though they are structured the same.

 

This is what i have:

 

// Get the user's info from the database by putting
// the user id stored in the session into the WHERE clause
$GetUserID = mysql_query("SELECT * FROM userregistration
                    WHERE UserID='{$_SESSION['Current_User']}'");
                  
// Fetch the row from the database
if (!($row = mysql_fetch_assoc($GetUserID))) {
    echo "User not found!";
    exit;
echo mysql_error();
}

$GetHouseInfo = mysql_query("SELECT * FROM houses
						WHERE UserID='{$_SESSION['Current_User']}'");

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

$UserID = $row["UserID"];
$HouseType = $houserow["HouseID"];

Echo $UserID
Echo $HouseType

 

The result is:

 

UserID : 23

House :

 

Anyone know why?

Link to comment
https://forums.phpfreaks.com/topic/65958-solved-echo-wont-work-on-second-query/
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.