what am i doing wrong here?
<?php
include 'connect.php';
$query = 'SELECT productionorder.Finished FROM productionorder WHERE productionorder.ProductionOrderId = '.$id;
$result = mysql_query($query) or die ('Error : ' . mysql_error());
while($data = mysql_fetch_array($result)){
$status = $data['Finished'];
}
if($status == 1){
header('location: index.php?user='.$user.'');
}
else{}
?>
the query returns 1 and is going to else statement
please help me out here..