function build_child($oldID) { // Refer to the global array defined at the top of this script global $exclude, $depth, $db, $tprefix, $editid; $tempR = array(); $child_sql = "SELECT * FROM `mu" . "_category` WHERE parent_id=" . $oldID; //echo $child_sql ; $child_query = $db->query($child_sql); $k = 0; while ($child = $child_query->fetch_array()) { if ($child['cat_id'] != $child['parent_id']) { for ($c = 0; $c < $depth; $c++) { } $tempR[$k]['cat_id'] = $child['cat_id']; $tempR[$k]['label'] = $child['cat_label']; $depth++; // Increment depth b/c we're building this child's child tree (complicated yet???) if (build_child($child['cat_id']) != FALSE) { $tempR[$k]['child'] = build_child($child['cat_id']); } $depth--; // Decrement depth b/c we're done building the child's child tree. ARRAY_PUSH($exclude, $child['cat_id']); // Add the item to the exclusion list $k++; } } if (!empty($tempR)) { return $tempR; } else { return FALSE; } // Return the entire child tree }
function build_child($oldID) { // Refer to the global array defined at the top of this script global $exclude, $depth, $db, $tprefix, $editid, $tld; $tempTree = ''; $child_sql = "SELECT * FROM `{$tprefix}" . "_category` WHERE parent_id=" . $oldID; //echo $child_sql ; $child_query = $db->query($child_sql); while ($child = $child_query->fetch_array()) { if ($child['cat_id'] != $child['parent_id']) { for ($c = 0; $c < $depth; $c++) { $tempTree .= " "; } $tempTree .= "- " . '<input type="checkbox" name="category[]" value="' . $child['cat_id'] . '" ' . check_category($editid, $child['cat_id']) . ' />' . $child['cat_label'] . '<a href="' . $tld . '/manage/settings/category-form.php?parent_id=' . $child['cat_id'] . '&parent_name=' . $child['cat_label'] . '">[+]</a><br>'; $depth++; // Incriment depth b/c we're building this child's child tree (complicated yet???) $tempTree .= build_child($child['cat_id']); // Add to the temporary local tree $depth--; // Decrement depth b/c we're done building the child's child tree. ARRAY_PUSH($exclude, $child['cat_id']); // Add the item to the exclusion list } } return $tempTree; // Return the entire child tree }
public static function TICKETS($DEV, $USER, $PM = '+') { $D = Date("Y-m-d"); $QUERY = "INSERT INTO core_stores_daily_devices (s_id, d_key, m_id, d_date) VALUES"; $PARAMS = array(); $I = 0; foreach ($DEV as $DE) { if ($I == 0) { $QUERY .= ' (?,?,?,?)'; } else { $QUERY .= ',(?,?,?,?)'; } ARRAY_PUSH($PARAMS, $USER['store'], 1, $DE, $D); $I++; } $QUERY .= " ON DUPLICATE KEY UPDATE d_key = d_key + 1"; MYSQL::QUERY($QUERY, $PARAMS); MYSQL::QUERY("INSERT INTO core_stores_daily_tickets (s_id, d_key, d_date) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE d_key = d_key + ?", array($USER['store'], $I, $D, $I)); }
<?php include_once 'sql_cls.php'; $sql = new sql_cls(); $where = array(); $w = ""; foreach ($_POST["Search_restrictions"] as $key => $val) { if ($key == "Platform") { if ($val != "NA") { ARRAY_PUSH($where, " b.consolePcName = '" . $val . "' "); } } } if (!empty($where)) { $w = "WHERE "; foreach ($where as $val) { $w .= $val; } } $result = $sql->query("\n\t\tSELECT count(l.gameName) AS 'Game Count'\n\t\tFROM gameName l\n\t\tINNER JOIN consolePc b\n\t\tON l.gameId = b.gameId\n\t\t{$w}\n\t"); if ($result != NULL && $result->num_rows > 0) { while ($row = mysqli_fetch_assoc($result)) { echo ceil(intval($row["Game Count"]) / 10); } }