Reputation:
i have a panel to confirm the users, there can be multiple selections with option select exc. I did the delete users part and its working perfect but with updating them to confirmed, i have some problems, i cant update the value of confirmation, here are the codes:
The Update Code from Panel :
if(isset($_POST["members"])) {
$members = $_POST["members"];
while(list($index, $member_id) = each($members)) {
confirmMembers($member_id); }
$msg = "Success";}
else { $msg = "Error"; }
The confirmMembers Function :
function confirmMembers($member_id) {
global $db, $log;
try {
$confirm_member = "UPDATE `members` SET `confirmed` = 1 WHERE `member_id` = :member_id LIMIT 1";
$confirm_member_do = $db->prepare($confirm_member);
$confirm_member_do->bindParam(':member_id', $member_id, PDO::PARAM_INT);
$confirm_member_do->execute();
return true;
} catch(PDOException $e) {
$log->logError($e." - ".basename(__FILE__));
return false;
}
}
Thanks
Upvotes: 2
Views: 182
Reputation:
At last i found the mistake, for all who may make the same mistake, confirmed row is an enum value and must be equal to '1' instead of 1, that fixed the error and now it's working.
$confirm_member = "UPDATE `members` SET `confirmed` = '1' WHERE `member_id` = :member_id LIMIT 1";
Thanks for all who replied.
Upvotes: 1