public function GetOrderData_m_diler($id_order) { $and['o.id_order'] = $id_order; $sql = "SELECT o.id_order, o.note2, o.note, o.target_date\r\n\t\t\tFROM " . _DB_PREFIX_ . "order o\r\n\t\t\t" . $this->db->GetWhere($and) . "\r\n\t\t\tGROUP BY o.id_order"; $arr = $this->db->GetArray($sql) or G::DieLoger("SQL - error: {$sql}"); return $arr; }
public function DeletePromoCode($id) { $promo_code_data = $this->GetPromoCodeById($id); $f['promo_code'] = 'NULL'; $this->db->StartTrans(); if (!$this->db->Update(_DB_PREFIX_ . 'user', $f, "promo_code = '" . $promo_code_data['code'] . "'")) { $this->db->FailTrans(); return false; } $sql = "DELETE FROM " . _DB_PREFIX_ . "promo_code WHERE id = {$id}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); $this->db->CompleteTrans(); return true; }
/** * Добавление и удаление фото * @param integer $id_news id новости * @param array $images_arr массив фотографий */ public function UpdatePhoto($id_news, $images_arr = array()) { $sql = "DELETE FROM " . _DB_PREFIX_ . "image_news WHERE id_news = " . $id_news; $this->db->StartTrans(); $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); $this->db->CompleteTrans(); $f['id_news'] = $id_news; if (isset($images_arr) && !empty($images_arr)) { $images = new Images(); $path = $GLOBALS['PATH_news_img'] . $id_news . '/'; $images->checkStructure($path); foreach ($images_arr as $src) { if (strpos($src, '\\temp/')) { $new_path = '/' . str_replace('\\temp/', '/' . $id_news . '/', $src); rename($GLOBALS['PATH_global_root'] . $src, $GLOBALS['PATH_global_root'] . $new_path); $src = $new_path; } $f['src'] = $src; $this->db->StartTrans(); if (!$this->db->Insert(_DB_PREFIX_ . 'image_news', $f)) { $this->db->FailTrans(); return false; } $this->db->CompleteTrans(); } } unset($id_news, $sql, $new_path, $f); return true; }
public function ClearDB($date) { list($d, $m, $y) = explode(".", trim($date)); $date = mktime(0, 0, 0, $m, $d, $y); $sql = "SELECT id_order\r\n\t\t\tFROM " . _DB_PREFIX_ . "order\r\n\t\t\tWHERE creation_date < '" . $date . "'"; $arr = $this->db->GetArray($sql); if (count($arr)) { $a = array(); foreach ($arr as $id) { $a[] = $id['id_order']; } $ids = implode(",", $a); $this->db->StartTrans(); $sql = "DELETE FROM " . _DB_PREFIX_ . "order WHERE id_order IN({$ids})"; if (!$this->db->Query($sql)) { $this->db->FailTrans(); G::DieLoger("SQL error - {$sql}"); return false; } $sql = "DELETE FROM " . _DB_PREFIX_ . "osp WHERE id_order IN({$ids})"; if (!$this->db->Query($sql)) { $this->db->FailTrans(); G::DieLoger("SQL error - {$sql}"); return false; } $sql = "DELETE FROM " . _DB_PREFIX_ . "pretense WHERE id_order IN({$ids})"; if (!$this->db->Query($sql)) { $this->db->FailTrans(); G::DieLoger("SQL error - {$sql}"); return false; } $this->db->CompleteTrans(); } return true; }
public function updateActiveAssort($id_assort, $active) { $product_limit = $active == 1 ? 10000000 : 0; $sql = "UPDATE " . _DB_PREFIX_ . "assortiment SET product_limit = " . $product_limit . "\n\t\t\t\tWHERE id_assortiment = " . $id_assort; $this->db->StartTrans(); $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); $this->db->CompleteTrans(); return true; }
/** * Мастер вставки * @param string $table * @param array $fields * @return bool */ public function Insert($table, $fields) { $keys = array_keys($fields); $values = array_values($fields); $sql = "INSERT INTO {$table} (`"; $sql .= implode("`, `", $keys); $sql .= "`) VALUES ("; foreach ($values as $key => $value) { if (gettype($value) == 'string') { $sql .= $this->Quote($value); } else { $sql .= "'" . $value . "'"; } if ($key < count($values) - 1) { $sql .= ', '; } } $sql .= ")"; // if(G::IsLogged() && $_SESSION['member']['id_user'] == 25143){ // print_r($sql); // } return $this->Query($sql) or G::DieLoger("SQL error - {$sql}"); }
} // Сортировка public function Reorder($arr) { foreach ($arr['ord'] as $_id => $ord) { $sql = "UPDATE " . _DB_PREFIX_ . "manufacturers SET `ord` = {$ord}\r\t\t\t\tWHERE manufacturer_id = {$_id}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}");
public function Reorder($arr) { foreach ($arr['ord'] as $id => $ord) { $sql = "UPDATE " . _DB_PREFIX_ . "parking\n\t\t\t\tSET ord = " . $ord . "\n\t\t\t\tWHERE id_parking = " . $id; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); } }
public function DeleteSlide($id) { $sql = "DELETE\n\t\t\tFROM " . _DB_PREFIX_ . "slides\n\t\t\tWHERE id = " . $id; $this->db->StartTrans(); $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); $this->db->CompleteTrans(); return true; }
public function DeleteWishes($id_wishes) { $sql = "DELETE FROM " . _DB_PREFIX_ . "wishes WHERE id_wishes = " . $id_wishes; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); return true; }
public function Reorder($arr) { foreach ($arr['ord'] as $id_config => $ord) { $sql = "UPDATE " . _DB_PREFIX_ . "config SET `ord` = {$ord}\r\n\t\t\t\t\tWHERE id_config = {$id_config}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); } }
public function Del($id) { $sql = "DELETE FROM " . _DB_PREFIX_ . "segmentation WHERE `id` = {$id}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); return true; }
public function DelCustomer($id) { $sql = "DELETE FROM " . _DB_PREFIX_ . "customer WHERE `id_user` = {$id}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); $sql = "DELETE FROM " . _DB_PREFIX_ . "user WHERE id_user={$id}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); return true; }
public function DelRemitter($id) { $sql = "DELETE FROM " . _DB_PREFIX_ . "remitter WHERE id={$id}"; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); return true; }
public function de1SeotextFormats($id) { $sql = 'DELETE FROM ' . _DB_PREFIX_ . 'seotext_formats WHERE id = ' . $id; $this->db->Query($sql) or G::DieLoger("<b>SQL Error - </b>{$sql}"); return true; }