I am having problems trying to update the two arrays of 'redflag' and 'qty', and i would like to know if i am on the right track or can someone please assist me with this simple coding, i'm a newbie in PHP. I have two input form fields once i submit the fields i am only able to update the 'QTY' array. How can i update both arrays?
foreach($_POST['update'] as $pid=>$nonce) // there will only ever be one
{
$selectql = $db->Execute("SELECT p.products_upc, p.products_isbn, p.products_id, p.products_quantity, p.products_image, p.products_model, pd.products_name FROM ".DB_PREFIX."products p LEFT JOIN ".DB_PREFIX."products_description pd ON p.products_id = pd.products_id WHERE p.products_id = " . (int)$pid);
$updated[$pid] = array(
'name' => stripslashes($selectql->fields['products_name']),
'model' => stripslashes($selectql->fields['products_model']),
'redflag' => $_POST['redflag'][$selectql->fields['products_isbn']],
'qty' => $_POST['qty'][$selectql->fields['products_id']],
'img' => stripslashes($selectql->fields['products_image']),
'notification_subscribed' => ''
);
}
}
} else if(isset($_POST['confirmed']) && $_POST['confirmed'] ==1) // show "done" page
{
$fields = array('qty', 'redflag');
foreach($_POST['update'] as $pid=>$qty)
{
$redflag = $_POST[$key];
$qty = $_POST[$key];
$selectql = $db->Execute("SELECT products_quantity, products_isbn FROM ".DB_PREFIX."products WHERE products_id = " . (int)$pid);
$updateql = $db->Execute("UPDATE ".DB_PREFIX."products SET products_quantity = " . (int)$qty ." WHERE products_id = " . (int)$pid);