我想弄清楚爲什麼我的if語句在if語句完成後返回值1。在if語句之後數組內部的值發生了變化?
$stmt = $db_con->prepare("SELECT id, username, managedby, commisionPercentage FROM `accounts` WHERE id = '$studentSignedUpBy'");
$stmt->execute();
$results = $stmt->fetchAll();
if ($results[0]['commisionPercentage'] =! 0) {
$agentCommisionPercentage = $results[0]['commisionPercentage'];
$commisiontype = 2;
}
echo $results[0]['managedby']; //this returns the correct value (25)
if ($results[0]['managedby'] =! 0) {
$managedStudentSignedUp = $results[0]['managedby'];
}
echo $results[0]['managedby']; //this returns the value 1 which ends up making $managedstudentSignedUp = 1 which is an issue.
這是'!='不'!=' –
不等於,不是不等於'如果( $ results [0] ['managedby']!= 0){' –
哦,哇!非常感謝你!今天早上我需要更多咖啡。 –