function allLanes($upc) { if (!class_exists("SQLManager")) { require_once "../../src/SQLManager.php"; } include '../lanedefs.php'; $queryItem = ''; $args = array(); if (is_numeric($upc)) { $upc = str_pad($upc, 13, 0, STR_PAD_LEFT); $queryItem = "SELECT * FROM products WHERE upc = ?"; $args = array($upc); } else { $queryItem = "SELECT * FROM products WHERE description LIKE ? ORDER BY description"; $args = array('%' . $upc . '%'); } for ($i = 0; $i < count($lanes); $i++) { $currentLane = $lanes[$i]; if (substr($currentLane, 0, 3) == "POS") { $currentLane = "129.103.2.1" . substr($currentLane, -1); } $sql = new SQLManager($currentLane, $types[$i], $dbs[$i], $users[$i], $pws[$i]); //continue; $prep = $sql->prepare($queryItem); $resultItem = $sql->execute($prep, $args); $num = $sql->num_rows($resultItem); if ($num == 0) { echo "Item <font color='red'>{$upc}</font> not found on Lane " . ($i + 1) . "<br />"; } else { if ($num > 1) { echo "Item <font color='red'>{$upc}</font> found multiple times on Lane " . ($i + 1) . "<br />"; while ($rowItem = $sql->fetch_array($resultItem)) { echo "{$rowItem['upc']} {$rowItem['description']}<br />"; } } else { $rowItem = $sql->fetch_array($resultItem); echo "Item <font color='red'>{$upc}</font> on Lane " . ($i + 1) . "<br />"; echo "Price: {$rowItem['normal_price']}"; if ($rowItem['special_price'] != 0) { echo " <font color=green>ON SALE: {$rowItem['special_price']}</font>"; } echo "<br />"; } } if ($i < count($lanes) - 1) { echo "<hr />"; } } }
function allLanes($upc) { global $FANNIE_LANES, $FANNIE_ROOT; if (!class_exists("SQLManager")) { require_once $FANNIE_ROOT . "src/SQLManager.php"; } $ret = ""; $queryItem = ''; if (is_numeric($upc)) { $upc = str_pad($upc, 13, 0, STR_PAD_LEFT); $queryItem = "SELECT * FROM products WHERE upc = '{$upc}'"; } else { $queryItem = "SELECT * FROM products WHERE description LIKE '%{$upc}%' ORDER BY description"; } for ($i = 0; $i < count($FANNIE_LANES); $i++) { $f = $FANNIE_LANES[$i]; $sql = new SQLManager($f['host'], $f['type'], $f['op'], $f['user'], $f['pw']); if ($sql === False) { $ret .= "Can't connect to lane: " . ($i + 1) . "<br />"; continue; } $resultItem = $sql->query($queryItem); $num = $sql->num_rows($resultItem); if ($num == 0) { $ret .= "Item <span style=\"color:red;\">{$upc}</span> not found on Lane " . ($i + 1) . "<br />"; } else { if ($num > 1) { $ret .= "Item <span style=\"color:red;\">{$upc}</span> found multiple times on Lane " . ($i + 1) . "<br />"; while ($rowItem = $sql->fetch_array($resultItem)) { $ret .= "{$rowItem['upc']} {$rowItem['description']}<br />"; } } else { $rowItem = $sql->fetch_array($resultItem); $ret .= "Item <span style=\"color:red;\">{$upc}</span> on Lane " . ($i + 1) . "<br />"; $ret .= "Price: {$rowItem['normal_price']}"; if ($rowItem['special_price'] != 0) { $ret .= " <span style=\"color:green;\">ON SALE: {$rowItem['special_price']}</span>"; } $ret .= "<br />"; } } if ($i < count($FANNIE_LANES) - 1) { $ret .= "<hr />"; } } return $ret; }
$selectCivi = "SELECT id, contact_id from civicrm_membership LIMIT 5;"; $civim = $dbConn->query("{$selectCivi}"); // Does not complain about error in MySQL statement. // See $LOGS/queries.log for them. if ($dbConn->errno) { $message = printf("Select failed: %s\n", $dbConn->error); dieHere("{$message}"); } // Quick test. echo "Civi Members Numbered\n"; // PHP Fatal error: Call to undefined method ADORecordSet_mysql::fetch_row() in /var/www/IS4C/fannie/cron/nightly.update.members.php on line 694 // PHP Fatal error: Call to undefined method ADORecordSet_mysql::fetch_array() in /var/www/IS4C/fannie/cron/nightly.update.members.php on line 694 //$res = $sql->query("SELECT month(datetime),year(datetime) FROM dtransactions"); //$row = $sql->fetch_row($res); //mysqli: while ( $row = $civim->fetch_row() ) {} while ($row = $dbConn->fetch_array($civim)) { // The numeric keys come first. 0,2,4. Name keys 1, 3, 5. $flds = getNameKeys($row); //$flds = array_keys($row); $lineOut = implode("\t", $flds) . "\n"; echo $lineOut; $lineOut = implode("\t", array($row[id], $row[contact_id])) . "\n"; echo $lineOut; // This gives duplicate values, for each of: first number, then name reference. //$lineOut = implode("\t", $row) . "\n"; // Reduce to one set. /* $vals = getNameValues($row); $lineOut = implode("\t", $vals) . "\n"; echo $lineOut; */
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']; $firstDeptName = $row['dept_name']; $query1 = "SELECT upc,description,normal_price,department,subdept,\n foodstamp,scale,qttyEnforced,discount,inUse,deposit\n FROM products WHERE upc = '{$upc}'"; $result1 = $dbc->query($query1); $row = $dbc->fetch_array($result1); echo "<table border=0>"; echo "<tr><td align=right><b>UPC</b></td><td><font color='red'>" . $row['upc'] . "</font><input type=hidden value='{$row['upc']}' name=upc></td>"; echo "</tr><tr><td><b>Description</b></td><td>{$row['description']}</td>"; echo "<td><b>Price</b></td><td>\${$row['normal_price']}</td></tr></table>"; echo "<table border=0><tr>"; echo "<th>Dept<th>Sub-Dept<th>FS<th>Scale<th>QtyFrc<th>NoDisc<th>inUse<th>deposit</b>"; echo "</tr>"; echo "<tr>"; $dept = $row['department']; if (is_numeric($dept)) {
echo "<a href=price_compare.php?sort=cat&buyer={$buyID}&filter={$filter}>Cat<a><th>"; } if ($sort == 'diff') { echo "<a href=price_compare.php?sort=diff1&buyer={$buyID}&filter={$filter}>Diff<a><th>"; } else { echo "<a href=price_compare.php?sort=diff&buyer={$buyID}&filter={$filter}>Diff<a><th>"; } if ($sort == 'variable_pricing') { echo "<a href=price_compare.php?sort=variable_pricing1&buyer={$buyID}&filter={$filter}>Var</a>"; } else { echo "<a href=price_compare.php?sort=variable_pricing&buyer={$buyID}&filter={$filter}>Var</a>"; } $i = 1; $strCat = "("; $cat_args = array(); while ($getCatW = $mysql->fetch_array($getCatR)) { $cat = $getCatW['unfi_cat']; //echo $cat . "<br>"; $strCat .= "?,"; $cat_args[] = $cat; } $strCat = substr($strCat, 0, -1); $strCat = $strCat . ")"; //echo $strCat; /** deprecating unfi_* tables $prep = $sql->prepare("SELECT u.*,p.cost,p.variable_pricing FROM $unfi_table as u left join prodExtra as p on u.upc=p.upc WHERE cat IN$strCat order by $sort,department,u.upc"); */ if ($filter != 'Yes') { $UNFI_ALL_QUERY .= ' AND p.normal_price <> v.srp '; }