The code below is part of an ajax script. Everything else is working perfectly except what is below.
I have no idea why this is happening :
$q_e = mysqli_query($sqllink,"SELECT * FROM events_parent WHERE id='$id_parent'");
$r_e = mysqli_fetch_array($q_e);
if($id_cure == $r_e['id_cure']){
$same = 1;
}else{
$same = 2;
}
if($same == 1){ //condition A
# cure is the same
mysqli_query($sqllink,"UPDATE events_parent ... ")
}elseif($same == 2){ // condition B
# cure is changed
mysqli_query($sqllink,"UPDATE events_parent ...")
}
No matter what the value of $same is, the my code still goes into condition A when it should just go into condition B. Even if i stop the script like this :
if($id_cure == $r_e['id_cure']){
$same = 1;
}else{
$same = 2;
}
echo "same : $same";
exit();
It outputs "same : 2", it does the mysql update correctly set in condition B but it also does the update set in condition A.
What am I doing wrong ? I tried using "===" instead of "==" but not result... Does anyone has an idea ?