当前位置: 首页>>代码示例>>PHP>>正文


PHP Db::insert方法代码示例

本文整理汇总了PHP中Db::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::insert方法的具体用法?PHP Db::insert怎么用?PHP Db::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Db的用法示例。


在下文中一共展示了Db::insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save()
 {
     $query = "INSERT INTO miembros values (null,'" . $this->getNombre() . "',null,'" . $this->getEmail() . "')";
     $conn = new Db("localhost", "root", "benjamin13");
     $conn->connect();
     $conn->insert($query, "conquistadores");
 }
开发者ID:niko-afv,项目名称:KS-Project,代码行数:7,代码来源:Miembro.php

示例2: visitorAdd

	/**
	 * 新增访客
	 *
	 * @param $param 添加信息数组
	 * @return 返回结果
	 */
	public function visitorAdd($param){
		if (empty($param)){
			return false;
		}
		$result = Db::insert('sns_visitor',$param);
		return $result;
	}
开发者ID:noikiy,项目名称:ejia,代码行数:13,代码来源:sns_visitor.model.php

示例3: createName

 public function createName()
 {
     $Verify = new Verify();
     $first = trim(strip_tags($_POST['first']));
     $middle = trim(strip_tags($_POST['middle']));
     $last = trim(strip_tags($_POST['last']));
     if (!$Verify->length($first, 255)) {
         $_SESSION['alert'] = 'Your first name is too long to store in the database.';
     } elseif (!$Verify->length($middle, 255)) {
         $_SESSION['alert'] = 'Your middle name is too long to store in the database.';
     } elseif (!$Verify->length($last, 255)) {
         $_SESSION['alert'] = 'Your last name is too long to store in the database.';
     } else {
         $Db = new Db();
         $query = $Db->query('user_name', array(array('user_id', '=', $_SESSION['user'], '')));
         $numrows = mysqli_num_rows($query);
         if ($numrows > 0) {
             $_SESSION['alert'] = 'Error, please try again.';
         } else {
             $insert = $Db->insert('user_name', array('', $_SESSION['user'], $first, $middle, $last));
             if (!$insert) {
                 $_SESSION['alert'] = 'The name could not be entered in the database.';
             } else {
                 $_SESSION['alert'] = 'Your name has successfully been entered.';
             }
         }
     }
 }
开发者ID:jryantz,项目名称:awc-framework,代码行数:28,代码来源:User_Name.php

示例4: put

 /**
  * @return integer
  */
 public function put()
 {
     if (null === $this->identifier) {
         throw new Exception('Identifier not found.');
     }
     $fields = array();
     $update = $this->properties[$this->identifier]->has();
     $return = 0;
     foreach ($this->properties as $name => $instance) {
         if (!is_subclass_of($instance, 'Property')) {
             continue;
         }
         if ($instance instanceof PropertyIdentifier) {
             continue;
         }
         $fields[$name] = $instance->get();
     }
     if ($update) {
         $return = $affected = $this->db->update($this->table, $fields, array($this->identifier => $this->properties[$this->identifier]->get()));
     } else {
         $return = $inserted = $this->db->insert($this->table, $fields);
         if ($inserted) {
             $this->properties[$this->identifier]->set($inserted);
         }
     }
     $this->hash = Model::hash($this->properties);
     return $return;
 }
开发者ID:joksnet,项目名称:php-old,代码行数:31,代码来源:Model.php

示例5: insertNews

 public function insertNews($url, $find_elm, $date)
 {
     $db = new Db();
     $content = file_get_html($url);
     foreach ($content->find($find_elm) as $news) {
         if (!empty($news)) {
             $db->insert('news', array('title' => $news->plaintext, 'date' => $date, 'last_update' => date('Y-m-d'), 'news_type' => static::$newsType));
         }
     }
     $settings = $db->query('SELECT * FROM settings WHERE news_type="' . static::$newsType . '"');
     if (!is_array($settings)) {
         $db->insert('settings', array('news_type' => static::$newsType, 'last_update' => date('Y-m-d')));
     } else {
         $db->update('settings', array('last_update' => date('Y-m-d')), array('news_type' => static::$newsType));
     }
 }
开发者ID:rozmarin-2013,项目名称:test_news,代码行数:16,代码来源:Parsers.php

示例6: add_coupon

 public function add_coupon($param)
 {
     if (!empty($param)) {
         return Db::insert('coupon', $param);
     }
     return false;
 }
开发者ID:noikiy,项目名称:ecmall,代码行数:7,代码来源:coupon.model.php

示例7: games

 /**
  * Example of an Endpoint
  */
 protected function games($_args)
 {
     // var_dump($this->method);
     // var_dump($this->endpoint);
     // var_dump($this->verb);
     // var_dump($this->args);
     // var_dump($this->file);
     // var_dump($this->request);
     $db = new Db();
     if ($this->method == 'GET') {
         // /games/id
         if (count($this->args)) {
             return $this->_response($db->select($this->endpoint, $this->args[0]));
             // /games/search?name=value
         } elseif ($this->verb === "search") {
             return $this->_response($db->search($this->endpoint, $this->request));
             // /games/
         } else {
             return $this->_response($db->select($this->endpoint));
         }
         // /games/?name=value1&description=value2
     } elseif ($this->method == 'POST') {
         return $this->_response($db->insert($this->endpoint, $this->request));
     } elseif ($this->method == 'PUT') {
         return $this->_response("UPDATE method not found", 404);
     } elseif ($this->method == 'DELETE') {
         return $this->_response("DELETE method not found", 404);
     } else {
         return $this->_response("Request error ", 500);
     }
 }
开发者ID:kakauandme,项目名称:gamesApp,代码行数:34,代码来源:myapi.php

示例8: add

 public static function add($post_id)
 {
     $post = Input::post(array('name', 'email', 'text'));
     $errors = array();
     if (empty($post['name'])) {
         $errors[] = 'Please enter your name';
     }
     if (filter_var($post['email'], FILTER_VALIDATE_EMAIL) === false) {
         $errors[] = 'Please enter a valid email address';
     }
     if (empty($post['text'])) {
         $errors[] = 'Please enter your comments';
     }
     if (count($errors)) {
         Notifications::set('error', $errors);
         return false;
     }
     $post['date'] = time();
     $post['status'] = Config::get('metadata.auto_published_comments', 0) ? 'published' : 'pending';
     $post['post'] = $post_id;
     // encode any html
     $post['text'] = Html::encode($post['text']);
     Db::insert('comments', $post);
     Notifications::set('success', 'Your comment has been sent');
     return true;
 }
开发者ID:reqshark,项目名称:anchor-cms,代码行数:26,代码来源:comments.php

示例9: saveGoods

 /**
  * 商品保存
  *
  * @param	array $param 商品资料
  */
 public function saveGoods($param)
 {
     if (empty($param)) {
         return false;
     }
     $goods_array = array();
     $goods_array['goods_name'] = $param['goods_name'];
     $goods_array['gc_id'] = $param['gc_id'];
     $goods_array['gc_name'] = $param['gc_name'];
     $goods_array['member_id'] = $_SESSION['member_id'];
     $goods_array['member_name'] = $_SESSION['member_name'];
     $goods_array['goods_image'] = $param['goods_image'];
     $goods_array['flea_quality'] = $param['flea_quality'];
     $goods_array['flea_area_id'] = $param['flea_area_id'];
     $goods_array['flea_area_name'] = $param['flea_area_name'];
     $goods_array['flea_pname'] = $param['flea_pname'];
     $goods_array['flea_pphone'] = $param['flea_pphone'];
     $goods_array['goods_tag'] = $param['goods_tag'];
     $goods_array['goods_price'] = $param['goods_price'];
     $goods_array['goods_store_price'] = $param['goods_store_price'];
     $goods_array['goods_show'] = $param['goods_show'];
     $goods_array['goods_commend'] = $param['goods_commend'];
     $goods_array['goods_add_time'] = time();
     $goods_array['goods_body'] = $param['goods_body'];
     $goods_array['goods_keywords'] = $param['goods_keywords'];
     $goods_array['goods_description'] = $param['goods_description'];
     $result = Db::insert('flea', $goods_array);
     return $result;
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:34,代码来源:flea.model.php

示例10: insert

 public function insert()
 {
     if (isset($this->values['id'])) {
         return false;
     }
     return Db::insert($this->table, $this->values);
 }
开发者ID:joksnet,项目名称:php-old,代码行数:7,代码来源:Model.php

示例11: commentAdd

 /**
  * 新增评论
  *
  * @param $param 添加信息数组
  * @return 返回结果
  */
 public function commentAdd($param)
 {
     if (empty($param)) {
         return false;
     }
     //处理文本中@信息
     if ($param['comment_content']) {
         preg_match_all("/@(.+?)([\\s|:]|\$)/is", $param['comment_content'], $matches);
         if (!empty($matches[1])) {
             //查询会员信息
             $member_model = Model('member');
             $member_list = $member_model->getMemberList(array('member_name' => array('in' => $matches[1])));
             foreach ($member_list as $k => $v) {
                 $param['comment_content'] = preg_replace("/@(" . $v['member_name'] . ")([\\s|:]|\$)/is", '<a href=\\"index.php?act=member_snsindex\\">@${1}</a>${2}', $param['comment_content']);
             }
         }
         unset($matches);
     }
     if (is_array($param)) {
         $result = Db::insert('sns_comment', $param);
         return $result;
     } else {
         return false;
     }
 }
开发者ID:norain2050,项目名称:xingkang,代码行数:31,代码来源:sns_comment.model.php

示例12: upload

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");
}
开发者ID:joksnet,项目名称:php-old,代码行数:30,代码来源:upload.php

示例13: saveGoods

 /**
  * 商品保存
  *
  * @param	array $param 商品资料
  */
 public function saveGoods($param)
 {
     if (empty($param)) {
         return false;
     }
     $goods_array = array();
     $goods_array['goods_name'] = $param['goods_name'];
     $goods_array['gc_id'] = $param['gc_id'];
     $goods_array['gc_name'] = $param['gc_name'];
     $goods_array['member_id'] = $_SESSION['member_id'];
     $goods_array['member_name'] = $_SESSION['member_name'];
     $goods_array['goods_image'] = $param['goods_image'];
     $goods_array['flea_Technical_types'] = $param['flea_Technical_types'];
     $goods_array['flea_area_id'] = $param['flea_area_id'];
     $goods_array['flea_area_name'] = $param['flea_area_name'];
     $goods_array['flea_pname'] = $param['flea_pname'];
     $goods_array['flea_pphone'] = $param['flea_pphone'];
     $goods_array['flea_trade_way'] = $param['flea_trade_way'];
     $goods_array['flea_maturity'] = $param['flea_maturity'];
     $goods_array['goods_store_price'] = $param['goods_store_price'];
     $goods_array['goods_show'] = $param['goods_show'];
     $goods_array['goods_commend'] = $param['goods_commend'];
     $goods_array['goods_status'] = $param['goods_status'];
     $goods_array['goods_add_time'] = time();
     $goods_array['goods_body'] = $param['goods_body'];
     $goods_array['goods_description'] = $param['goods_description'];
     $goods_array['goods_leixing'] = $param['goods_leixing'];
     $result = Db::insert('flea', $goods_array);
     return $result;
 }
开发者ID:Maplecms,项目名称:shopnc-api,代码行数:35,代码来源:flea.model.php

示例14: addFavorites

 /**
  * 新增收藏
  *
  * @param array $param 参数内容
  * @return bool 布尔类型的返回结果
  */
 public function addFavorites($param)
 {
     if (empty($param)) {
         return false;
     }
     return Db::insert('favorites', $param);
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:13,代码来源:favorites.model.php

示例15: addMember

 /**
  * 注册商城会员
  *
  * @param	array $param 会员信息
  * @return	array 数组格式的返回结果
  */
 public function addMember($param)
 {
     if (empty($param)) {
         return false;
     }
     $member_info = array();
     $member_info['member_id'] = $param['member_id'];
     $member_info['member_name'] = trim($param['member_name']);
     $member_info['member_passwd'] = md5(trim($param['member_passwd']));
     $member_info['member_email'] = trim($param['member_email']);
     $member_info['member_mobile'] = trim($param['member_mobile']);
     $member_info['member_time'] = time();
     $member_info['member_login_time'] = $member_info['member_time'];
     $member_info['member_old_login_time'] = $member_info['member_time'];
     $member_info['member_login_ip'] = getIp();
     $member_info['member_old_login_ip'] = $member_info['member_login_ip'];
     $member_info['member_truename'] = $param['member_truename'];
     $member_info['member_qq'] = $param['member_qq'];
     $member_info['member_sex'] = $param['member_sex'];
     $member_info['member_avatar'] = $param['member_avatar'];
     $member_info['member_qqopenid'] = $param['member_qqopenid'];
     $member_info['member_qqinfo'] = $param['member_qqinfo'];
     $member_info['member_sinaopenid'] = $param['member_sinaopenid'];
     $member_info['member_sinainfo'] = $param['member_sinainfo'];
     $result = Db::insert('member', $member_info);
     if ($result) {
         return Db::getLastId();
     } else {
         return false;
     }
 }
开发者ID:my1977,项目名称:shopnc,代码行数:37,代码来源:member.model.php


注:本文中的Db::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。