delete() public method

删除记录
public delete ( array $options = [] ) : false | integer
$options array 表达式
return false | integer | integer
Beispiel #1
1
 public function deleteCurrency($currencyId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "currency_id='" . $currencyId . "'";
     $db->delete(CURRENCY, $condition1);
 }
Beispiel #2
0
 public function deleteSpecification($specId)
 {
     echo $specId;
     global $mySession;
     $db = new Db();
     $condition1 = "spec_id='" . $specId . "'";
     $db->delete(SPECIFICATION, $condition1);
     $db->delete(SPEC_CHILD, $condition1);
 }
Beispiel #3
0
 public function deleteAttribute($attributeId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "attribute_id='{$attributeId}'";
     $db->delete(ATTRIBUTE, $condition1);
     //delete all attribute_ans entries
     $condition2 = "ans_attribute_id= '{$attributeId}'";
     $db->delete(ATTRIBUTE_ANS, $condition2);
 }
Beispiel #4
0
 public function deletereview($ptyleId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "review_id='" . $ptyleId . "'";
     $chkQuery = $db->runQuery("select * from " . OWNER_REVIEW . " where review_id = '" . $ptyle_id . "' ");
     if ($chkQuery[0]['parent_id'] == '0') {
         $condition = "parent_id=" . $ptyle_id;
         $db->delete(OWNER_REVIEW, $condition);
     }
     $db->delete(OWNER_REVIEW, $condition1);
 }
Beispiel #5
0
 public function deleteAmenity($ptyleId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "amenity_id='" . $ptyleId . "'";
     $db->delete(AMENITY, $condition1);
 }
Beispiel #6
0
 protected function delete()
 {
     if (empty($this->id)) {
         throw new Exception('Delete error - Undefined ' . self::getClass() . ' id');
     }
     return Db::delete('DELETE FROM ' . self::getDbTable() . ' WHERE id = :id', array('id' => $this->id));
 }
Beispiel #7
0
 public function deleteProtype($ptyleId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "ptyle_id='" . $ptyleId . "'";
     $db->delete(PROPERTYTYPE, $condition1);
 }
Beispiel #8
0
function upload()
{
    global $root;
    if ($_FILES['sub']['size'] == 0 && $_FILES['sub']['error'] > 0) {
        return 'Error al subir el subtítulo.';
    }
    $file = $_FILES['sub']['name'];
    $frame = Request::getPost('frame');
    $comment = Request::getPost('comment');
    $credits = Request::getPost('credits');
    if (empty($frame)) {
        return 'Falta el frame.';
    }
    $format = substr($file, -3);
    $formatName = Formats::get($format);
    if (empty($formatName)) {
        return 'El archivo no es de un formato válido.';
    }
    $filename = substr($file, 0, strlen($file) - 4);
    $id = Db::insert('subs', array('filename' => $filename, 'ext' => $format, 'frame' => $frame, 'comment' => $comment, 'credits' => $credits, 'time' => time()));
    $fullpath = "{$root}/upload/{$id}";
    # $fullpath = "/var/www/subs/$id";
    if (!@move_uploaded_file($_FILES['sub']['tmp_name'], $fullpath)) {
        if ($id) {
            Db::delete('subs', "id = '{$id}'");
        }
        return 'No se logró subir el archivo, intente nuevamente en unos minutos.';
    }
    header("Location: /{$id}.html");
}
Beispiel #9
0
 public function clearAllSessions($user)
 {
     if (empty($user)) {
         return;
     }
     Db::delete('Session', 'user_id = ?', array($user->getId()));
 }
Beispiel #10
0
 public function deleteOffer($sId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "id='" . $sId . "'";
     $db->delete(SPCL_OFFER_TYPES, $condition1);
 }
Beispiel #11
0
 public function deleteNews($ptyleId)
 {
     global $mySession;
     $db = new Db();
     $condition1 = "news_id='" . $ptyleId . "'";
     $db->delete(NEWS, $condition1);
 }
 public static function save()
 {
     if (self::$settings !== null) {
         // Da nicht gewährleistet ist, dass überhaupt ein Eintrag existiert, oder dass es wirklich nur einer ist,
         // einfach die Settings-Tabelle komplett platt machen und den Eintrag neu erzeugen.
         Db::delete('settings', '1', array());
         Db::insert('settings', array('json' => json_encode(self::$settings)));
     }
 }
Beispiel #13
0
 /**
  * @return integer
  */
 public function delete()
 {
     if (null === $this->identifier) {
         throw new Exception('Identifier not found.');
     }
     $affected = $this->db->delete($this->table, array($this->identifier => $this->properties[$this->identifier]->get()));
     $this->clear();
     return $affected;
 }
Beispiel #14
0
	/**
	 * 删除水印
	 *
	 * @param int $id 记录ID
	 * @return bool 布尔类型的返回结果
	 */
	public function delStoreWM($id){
		if (intval($id) > 0){
			$where = " wm_id = '". intval($id) ."'";
			$result = Db::delete('store_watermark',$where);
			return $result;
		}else {
			return false;
		}
	}
Beispiel #15
0
 public function UpdateGroupTopic($dataForm, $topic_id)
 {
     global $mySession;
     $db = new Db();
     $sqlstr = "select * from " . GROUP_TPOIC . " where topic_name='" . $dataForm['topic_name'] . "' and topic_id!='" . $topic_id . "'";
     $chkQry = $db->runQuery($sqlstr);
     if ($chkQry != "" and count($chkQry) > 0) {
         return 0;
     } else {
         $dataForm['topic_status'] = 1;
         $dataForm['created_by'] = $mySession->adminId;
         $update_condition = "topic_id='" . $topic_id . "'";
         $topicgroup = $dataForm['topic_group'];
         unset($dataForm['topic_group']);
         if ($dataForm['topic_access_type'] == 1) {
             $groupMember = $dataForm['group_member'];
         } else {
             $groupMember = "";
         }
         unset($dataForm['group_member']);
         $db->modify(GROUP_TPOIC, $dataForm, $update_condition);
         $condition = "topic_id='" . $topic_id . "'";
         $db->delete(GROUP_TPOIC_CATEGORIES, $condition);
         $data['m_status'] = 1;
         $db->modify(GROUP_MEMBER, $data, $condition);
         //$db->delete(GROUP_MEMBER,$condition);
         unset($dataForm);
         if (is_array($topicgroup)) {
             foreach ($topicgroup as $key => $value) {
                 $dataForm['category_id'] = $value;
                 $dataForm['topic_id'] = $topic_id;
                 $db->save(GROUP_TPOIC_CATEGORIES, $dataForm);
                 unset($dataForm);
             }
         }
         if (is_array($groupMember)) {
             foreach ($groupMember as $key => $value) {
                 if (isset($dataForm)) {
                     unset($dataForm);
                 }
                 $dataForm['m_status'] = 1;
                 $sqlstr = "select * from " . GROUP_MEMBER . " where member_id='" . $value . "' and topic_id='" . $topic_id . "'";
                 if ($chkQry != "" and count($chkQry) > 0) {
                     $update_condition = "member_id='" . $value . "' and topic_id='" . $topic_id . "'";
                     $db->modify(GROUP_MEMBER, $dataForm, $update_condition);
                 } else {
                     $dataForm['member_id'] = $value;
                     $dataForm['topic_id'] = $topic_id;
                     $db->save(GROUP_MEMBER, $dataForm);
                 }
                 unset($dataForm);
             }
         }
         return 1;
     }
 }
Beispiel #16
0
 /**
  * 更新
  * 
  * @param unknown_type $param
  */
 public function del($id)
 {
     if (intval($id) > 0) {
         $where = " view_id = '" . intval($id) . "'";
         $result = Db::delete('view', $where);
         return $result;
     } else {
         return false;
     }
 }
Beispiel #17
0
 /**
  * 删除
  *
  * @param int $id 记录ID
  * @return bool 布尔类型的返回结果
  */
 public function del($id)
 {
     if (intval($id) > 0) {
         $where = " id = '" . intval($id) . "'";
         $result = Db::delete('mb_feedback', $where);
         return $result;
     } else {
         return false;
     }
 }
Beispiel #18
0
 public static function delete($id)
 {
     // verify Csrf token
     if (Csrf::verify(Input::post('token')) === false) {
         Notifications::set('error', 'Invalid token');
         return false;
     }
     Db::delete('pages', array('id' => $id));
     Notifications::set('success', Lang::line('pages.page_success_delete', 'Your page has been deleted'));
     return true;
 }
Beispiel #19
0
 public function removeSize($sno)
 {
     $db = new Db();
     $res = false;
     if ($sno && (int) $sno > 0) {
         error_log('removeSize sno: ' . $sno);
         $condition = "sizeid='" . (int) $sno . "'";
         $res = $db->delete(TSHIRT_SIZE, $condition);
     }
     return $res;
 }
Beispiel #20
0
 public function saveReview($dataForm)
 {
     global $mySession;
     $db = new Db();
     $data_update = array();
     $chckArr = $db->runQuery("select * from " . PROPERTY . " where propertycode = '" . trim($dataForm['ppty_no']) . "' and status = '3'");
     if (count($chckArr) > 0 && $chckArr != "") {
         $data_update['guest_name'] = $dataForm['full_name'];
         $data_update['location'] = $dataForm['location'];
         $check_in = explode("/", $dataForm['check_in']);
         $data_update['check_in'] = date('Y-m-d', strtotime($check_in[2] . "-" . $check_in[1] . "-" . $check_in[0]));
         $data_update['rating'] = $dataForm['rating'];
         $data_update['user_id'] = $mySession->LoggedUserId;
         $data_update['headline'] = $dataForm['headline'];
         $data_update['comment'] = $dataForm['comment'];
         $data_update['review'] = $dataForm['review'];
         $data_update['uType'] = $mySession->LoggedUserType == '1' ? "1" : "0";
         $data_update['review_date'] = date("Y-m-d");
         $data_update["property_id"] = $chckArr[0]['id'];
         $data_update['guest_image'] = $mySession->LoggedUser['image'];
         copy(SITE_ROOT . "images/" . $mySession->LoggedUser['image'], SITE_ROOT . "images/profile/" . $mySession->LoggedUser['image']);
         $db->save(OWNER_REVIEW, $data_update);
         $review_id = $db->lastInsertId();
         //====== code to enter new latest review properties ===============
         //two cases are there
         //1. if already an entry is there within latest reviews
         //2. first entry is made for specific property
         $reviewPptyArr = $db->runQuery("select * from " . LATEST_REVIEW . " where r_property_id = '" . $chckArr[0]['id'] . "'  ");
         //case 1
         if (count($reviewPptyArr) > 0 && $reviewPptyArr != "") {
             $db->delete(LATEST_REVIEW, "r_id = " . $reviewPptyArr[0]['r_id']);
             $updateData = array();
             $updateData['r_order'] = new Zend_Db_Expr('r_order-1');
             $db->modify(LATEST_REVIEW, $updateData, "r_order > " . $reviewPptyArr[0]['r_order']);
         } else {
             $updateData = array();
             $updateData['r_order'] = new Zend_Db_Expr('r_order+1');
             $db->modify(LATEST_REVIEW, $updateData);
             $saveData = array();
             $saveData['r_property_id'] = $chckArr[0]['id'];
             $saveData['r_order'] = '1';
             //$saveData['r_review_id'] = $review_id;
             $saveData['r_status'] = '1';
             $db->save(LATEST_REVIEW, $saveData);
         }
         //-----------------------------------------------------------------
         return 1;
     } else {
         return 0;
     }
 }
Beispiel #21
0
 public function deleteSpeccat($cId)
 {
     global $mySession;
     $db = new Db();
     //check if the child entry is there
     $chkQuery = $db->runQuery("select * from " . SPECIFICATION . " where cat_id = '" . $cId . "' ");
     if ($chkQuery != "" && count($chkQuery) > 0) {
         return 0;
     } else {
         $condition1 = "cat_id='" . $cId . "'";
         $db->delete(PROPERTY_SPEC_CAT, $condition1);
         return 1;
     }
 }
Beispiel #22
0
 public function deletemsgsAction()
 {
     global $mySession;
     $db = new Db();
     if ($_REQUEST['Id'] != "") {
         $arrId = explode("|", $_REQUEST['Id']);
         if (count($arrId) > 0) {
             foreach ($arrId as $key => $Id) {
                 $condition1 = "message_id='" . $Id . "'";
                 $db->delete(MESSAGES, $condition1);
             }
         }
     }
     exit;
 }
Beispiel #23
0
 public function deletecommentAction()
 {
     global $mySession;
     $db = new Db();
     if ($_REQUEST['Id'] != "") {
         $arrId = explode("|", $_REQUEST['Id']);
         if (count($arrId) > 0) {
             foreach ($arrId as $key => $Id) {
                 $condition1 = "comment_id='" . $Id . "'";
                 $db->delete(POST_COMMENT, $condition1);
             }
         }
     }
     exit;
 }
Beispiel #24
0
 public function delete()
 {
     $id = $_POST['id'];
     if (is_numeric($id)) {
         $Db = new Db();
         $query = $Db->query('user', array(array('id', '=', $id, '')));
         $numrows = mysqli_num_rows($query);
         if ($numrows != 1) {
             $_SESSION['alert'] = 'Error, please try again.';
         } else {
             $delete = $Db->delete('user', array(array('id', '=', $id, '')));
             if (!$delete) {
                 $_SESSION['alert'] = 'User account could not be deleted.';
             } else {
                 $_SESSION['alert'] = 'User deleted.';
             }
         }
     }
 }
 public function unassignAllConntectedDataTableRows($row_id, $connection_id)
 {
     $connected_data_table = $this->getConnectedDataTableById($connection_id);
     if ($connected_data_table !== false) {
         $row_id = intval($row_id);
         $res = Db::delete($connected_data_table['dbTable'], "`" . $connected_data_table['dbKeySelf'] . "` = :rowId", array(':rowId' => $row_id));
         return $res !== false;
     }
     return false;
 }
 public function drop($param)
 {
     $where = $this->getCondition($param);
     return Db::delete(self::TABLE_NAME, $where);
 }
Beispiel #27
0
 public function dropInform($param)
 {
     $where = $this->getCondition($param);
     return Db::delete('inform', $where);
 }
Beispiel #28
0
 /**
  * 页面导航
  */
 public function navigationOp()
 {
     $lang = Language::getLangContent();
     $model_navigation = Model('navigation');
     /**
      * 删除
      */
     if (chksubmit()) {
         if (is_array($_POST['del_id']) && !empty($_POST['del_id'])) {
             $del_str = implode(',', $_POST['del_id']);
             $where = "where nav_id in (" . $del_str . ")";
             Db::delete("navigation", $where);
             dkcache('nav');
             $this->log(L('navigation_index_del_succ') . '[ID:' . $del_str . ']', null);
             showMessage($lang['navigation_index_del_succ']);
         } else {
             showMessage($lang['navigation_index_choose_del']);
         }
     }
     /**
      * 检索条件
      */
     $condition['like_nav_title'] = trim($_GET['search_nav_title']);
     $condition['nav_location'] = trim($_GET['search_nav_location']);
     $condition['order'] = 'nav_sort asc';
     /**
      * 分页
      */
     $page = new Page();
     $page->setEachNum(10);
     $page->setStyle('admin');
     $navigation_list = $model_navigation->getNavigationList($condition, $page);
     /**
      * 整理内容
      */
     if (is_array($navigation_list)) {
         foreach ($navigation_list as $k => $v) {
             switch ($v['nav_location']) {
                 case '0':
                     $navigation_list[$k]['nav_location'] = $lang['navigation_index_top'];
                     break;
                 case '1':
                     $navigation_list[$k]['nav_location'] = $lang['navigation_index_center'];
                     break;
                 case '2':
                     $navigation_list[$k]['nav_location'] = $lang['navigation_index_bottom'];
                     break;
             }
             switch ($v['nav_new_open']) {
                 case '0':
                     $navigation_list[$k]['nav_new_open'] = $lang['nc_no'];
                     break;
                 case '1':
                     $navigation_list[$k]['nav_new_open'] = $lang['nc_yes'];
                     break;
             }
         }
     }
     Tpl::output('navigation_list', $navigation_list);
     Tpl::output('page', $page->show());
     Tpl::output('search_nav_title', trim($_GET['search_nav_title']));
     Tpl::output('search_nav_location', trim($_GET['search_nav_location']));
     Tpl::showpage('navigation.index');
 }
 /**
  * 删除分享商品
  */
 public function delSharestore($condition)
 {
     if (empty($condition)) {
         return false;
     }
     $condition_str = '';
     if ($condition['share_id'] != '') {
         $condition_str .= " and share_id='{$condition['share_id']}' ";
     }
     if ($condition['share_memberid'] != '') {
         $condition_str .= " and share_memberid='{$condition['share_memberid']}' ";
     }
     return Db::delete('sns_sharestore', $condition_str);
 }
Beispiel #30
0
 function delete()
 {
     if ($_ENV['sessionUseDb']) {
         $data = Db::delete($_ENV['sessionDbTable'], array('id' => $_COOKIE['sessionId']));
     } else {
         $data = unlink($this->file);
     }
 }