Paul,
Perhaps you can spot what I'm doing wrong here... I am adding a checkbox for product_is_call (and maybe the others if I figure this out!) and just can't seem to get it to work correctly. This is as CLOSE as I'm getting:
Code:
// product_is_call - added by chadd
if($_POST['quick_updates_old']['product_is_call']){
foreach($_POST['quick_updates_old']['product_is_call'] as $products_id => $status) {
if ($_POST['quick_updates_new']['product_is_call'][$products_id] != $_POST['quick_updates_old']['product_is_call'][$products_id]) {
$quick_updates_count['product_is_call'][$products_id] = $products_id;
if (!isset($_POST['quick_updates_new']['product_is_call'][$products_id])) {
$db->Execute("UPDATE " . TABLE_PRODUCTS . " SET product_is_call='" . '0' . "', products_last_modified=now() WHERE products_id=" . (int)$products_id);
}
else {
$db->Execute("UPDATE " . TABLE_PRODUCTS . " SET product_is_call='" . '1' . "', products_last_modified=now() WHERE products_id=" . (int)$products_id);
}
}
}
}
This will let me set and unset the product_is_call field, but it does it for every product on the page, not just the one changed.
If I use "new" instead of "old":
Code:
// product_is_call - added by chadd
if($_POST['quick_updates_new']['product_is_call']){
foreach($_POST['quick_updates_new']['product_is_call'] as $products_id => $status) {
if ($_POST['quick_updates_new']['product_is_call'][$products_id] != $_POST['quick_updates_old']['product_is_call'][$products_id]) {
$quick_updates_count['product_is_call'][$products_id] = $products_id;
if (!isset($_POST['quick_updates_new']['product_is_call'][$products_id])) {
$db->Execute("UPDATE " . TABLE_PRODUCTS . " SET product_is_call='" . '0' . "', products_last_modified=now() WHERE products_id=" . (int)$products_id);
}
else {
$db->Execute("UPDATE " . TABLE_PRODUCTS . " SET product_is_call='" . '1' . "', products_last_modified=now() WHERE products_id=" . (int)$products_id);
}
}
}
}
I can only SET the checkmark, not UNSET it, it updates, but doesn't change the database for unsetting checkmark.
I've tried a dozen different ways, but seem to be missing something... hope you can point me in the right direction!
-Chaddro
Bookmarks