예제 #1
0
 public function insertUnits(Units $units)
 {
     $con = self::openConnection();
     $affected = 0;
     mysqli_begin_transaction($con);
     $stm = mysqli_stmt_init($con);
     $sql = "INSERT INTO currency (code) VALUE (?)";
     mysqli_stmt_prepare($stm, $sql);
     foreach ($units->getUnits() as $unit) {
         $code = $unit->getCode();
         mysqli_stmt_bind_param($stm, 's', $code);
         mysqli_stmt_execute($stm);
         if (mysqli_affected_rows($con) == 1) {
             $affected++;
         }
     }
     if ($affected > 0) {
         mysqli_commit($con);
     } else {
         mysqli_rollback($con);
     }
     return $affected;
 }
예제 #2
0
    DBUtils::checkResult($rc, NULL, NULL, $sql);
    // get the list of sections to display, default is 'default'
    $useLayout = split(',', $rc->fields[0]);
    if (!count($useLayout)) {
        $useLayout[] = '';
    }
    //if it does not exist, set it to empty
} else {
    // No store is selected, use the default all sections store
    foreach ($locations as $key => $value) {
        $useLayout[] = $key;
        // add the section
    }
}
// Load the units we are to deal with
$units = Units::getUnits();
// Get the shopping list
$items = array();
if (is_object($listObj)) {
    $items = $listObj->getShoppingList();
}
$printedItems = 0;
//keep track of how many items we show at once
if ($mode == "print") {
    /*************************************************
    			Print the prelim List
    *************************************************/
    ?>
<SCRIPT language="javascript">
<!--
function submitIt(mode) {