Jump to content

query gets two fields from the wrong rows


SirChick

Recommended Posts

I have a query which gets to two fields.. one is from one row and the other field is coming from a different row when they should be the same row! It makes no sense i've not had this problem before... and i dont see any problem with my query either this is what i have:

 

 

<?
$GetUserCars = mysql_query("SELECT * FROM cars
                    WHERE UserID='{$_SESSION['Current_User']}' AND Equipped='1'")
			or die(mysql_error());	
                  
// Fetch the row from the database
if (!($carsrow = mysql_fetch_assoc($GetUserCars))) {
    
Header ("location: myhouseinfo.php");
    
}else{
$CarCondition = $carsrow['Longetivity'];
$PetrolLeft = $carsrow['FuelLeft'];
}

Echo $CarCondition;
Echo $PetrolLeft;
?>

Also only one of the rows has Equipped set to 1 the other is set to 0 so there is something wrong at that part of the query.. not sure why

 

I have attatched pictures to show you:

 

As you see the second row is echo'd for fuel left and row 1 is echo'd for CarCondition so i dont get how :S

 

 

 

[attachment deleted by admin]

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.