예제 #1
0
//   We're not in the right environment for that.
$dbc = new SQLManager($FANNIE_SERVER, $FANNIE_SERVER_DBMS, $FANNIE_OP_DB, $FANNIE_SERVER_USER, $FANNIE_SERVER_PW);
/* 'i9el. Update likecodes */
/* update the item's likecode if specified
   also update other items in the likecode
   if the appropriate box isn't checked */
if (isset($_REQUEST['likeCode']) && $_REQUEST['likeCode'] != -1) {
    $dbc->query("DELETE FROM upcLike WHERE upc='{$upc}'");
    $lcQ = "INSERT INTO upcLike (upc,likeCode) VALUES ('{$upc}',{$_REQUEST['likeCode']})";
    $dbc->query($lcQ);
    if (!isset($_REQUEST['update'])) {
        $upcsQ = "SELECT upc FROM upcLike WHERE likeCode={$_REQUEST['likeCode']} AND upc <> '{$upc}'";
        $upcsR = $dbc->query($upcsQ);
        unset($up_array['description']);
        while ($upcsW = $dbc->fetch_row($upcsR)) {
            $dbc->smart_update('products', $up_array, "upc='{$upcsW['0']}' AND store_id={$FANNIE_STORE_ID}");
            updateProductAllLanes($upcsW[0]);
        }
    }
} elseif (isset($_REQUEST['likeCode']) && $_REQUEST['likeCode'] == -1) {
    $dbc->query("DELETE FROM upcLike WHERE upc='{$upc}'");
}
/* 11. Display the post-update values and an input for the next edit.  */
/* Display some of the post-update values and an input for the next edit.
 * The page contains form elements but there is no submit for the them.
 * The record-select input is also displayed in a proper form with a submit.
*/
$deptQ = "SELECT dept_no, dept_name FROM departments ORDER BY dept_no";
$deptR = $dbc->query($deptQ);
$row = $dbc->fetch_array($deptR);
$firstDeptNo = $row['dept_no'];