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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.