本文整理汇总了PHP中Model::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::execute方法的具体用法?PHP Model::execute怎么用?PHP Model::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: excity
/**
*导入城市指南分类
*@date 2010-4-27
*@time 下午02:14:17
*/
function excity()
{
//导入城市指南分类
$old = M("Sort");
$list = $old->order("fid asc")->findAll();
$dao = new Model();
$sql = "INSERT INTO `iic_arctype` (`id`, `reid`, `topid`, `sortrank`, `typename`, `ename`, `typedir`, `issend`, `channeltype`, `uid`, `cid`, `maxpage`, `ispart`, `corank`, `tempindex`, `templist`, `temparticle`, `namerule`, `namerule2`, `modname`, `description`, `keywords`, `seotitle`, `moresite`, `sitepath`, `siteurl`, `ishidden`, `cross`, `hits`, `posttime`, `mtime`, `crossid`, `content`, `smalltypes`)";
$sql .= " VALUES (1000, '0', '0', '0', 'City Guide', 'cityguide', '', '', '2', 0, '', '25', '0', '', '', '', '', '', '', '', '', 'description', '', '', '', '', '', '0', 0," . time() . ", 0, '', '', '1000__1000');";
if ($dao->execute($sql)) {
echo '写入城市指南大类成功';
} else {
echo '<b>写入城市指南大类不成功</b>';
}
echo '<br>';
//dump($list);
foreach ($list as $v) {
$v['fid'] = $v['fid'] + 1000;
$v['fup'] = $v['fup'] + 1000;
$sql = "INSERT INTO `iic_arctype` (`id`, `reid`, `topid`, `sortrank`, `typename`, `ename`, `typedir`, `issend`, `channeltype`, `uid`, `cid`, `maxpage`, `ispart`, `corank`, `tempindex`, `templist`, `temparticle`, `namerule`, `namerule2`, `modname`, `description`, `keywords`, `seotitle`, `moresite`, `sitepath`, `siteurl`, `ishidden`, `cross`, `hits`, `posttime`, `mtime`, `crossid`, `content`, `smalltypes`)";
$sql .= "VALUES (";
$sql .= "{$v['fid']},{$v['fup']},1000,{$v['list']},'{$v['name']}','','','',";
$sql .= 2;
//系统模型
$sql .= ",'','','25','{$v['type']}','','','','','','','','','description','{$v['name']}','','','','','0','0','" . time() . "','0','','','{$v['fid']}__{$v['fup']}');";
// `description`, `keywords`, `seotitle`, `moresite`, `sitepath`, `siteurl`, `ishidden`, `cross`, `hits`, `posttime`, `mtime`, `crossid`, `content`, `smalltypes`
//echo $sql;
if ($dao->execute($sql)) {
echo '分类:' . $v['fid'] . '-> ' . $v['name'] . '执行成功';
} else {
echo '分类:' . $v['fid'] . '-> ' . $v['name'] . '执行不成功';
}
echo "<br>";
}
}
示例2: create
public function create($sqlFlag = false)
{
$sql = "REPLACE INTO {$this->tableName} VALUES (\n '{$this->school}','{$this->gradeId}','{$this->classId}','{$this->className}',\n '{$this->stuName}', '{$this->stuId}', {$this->sex},'{$this->nationId}','{$this->birthDay}',\n '{$this->sourcePlace}','{$this->IDCard}','{$this->homeAddress}',{$this->height}, {$this->weight},\n {$this->BMIMark}, {$this->BMIScore}, {$this->BMIGrade},\n {$this->FVCMark}, {$this->FVCScore}, {$this->FVCGrade},\n {$this->_50mMark}, {$this->_50mScore}, {$this->_50mGrade},\n {$this->SARMark}, {$this->SARScore}, {$this->SARGrade},\n {$this->SLJMark}, {$this->SLJScore}, {$this->SLJGrade},\n {$this->ChinUpMark}, {$this->ChinUpScore}, {$this->ChinUpAdditionalScore}, {$this->ChinUpGrade},\n {$this->SitUpsMark}, {$this->SitUpsScore}, {$this->SitUpsAdditionalScore}, {$this->SitUpsGrade},\n '{$this->_1000mMark}', {$this->_1000mScore}, {$this->_1000mAdditionalScore}, {$this->_1000mGrade},\n '{$this->_800mMark}', {$this->_800mScore}, {$this->_800mAdditionalScore}, {$this->_800mGrade},\n '{$this->_400mMark}', {$this->_400mScore}, {$this->_400mAdditionalScore}, {$this->_400mGrade},\n {$this->ropeSkippingMark}, {$this->ropeSkippingScore}, {$this->ropeSkippingAdditionalScore}, {$this->ropeSkippingGrade},\n {$this->standardPoints}, {$this->additionalPoints}, {$this->SumUpScore}, {$this->SumUpGrade}\n )\n ";
// echo $sql;
if ($sqlFlag) {
return $sql . ';';
}
return parent::execute($sql);
}
示例3: save
function save()
{
$this->import_parameters();
if (!isset($this->notes) || empty($this->notes)) {
$sql = "DELETE from project_notes\n WHERE project_id = {$this->project_id}";
return parent::execute($sql);
} else {
return parent::save();
}
}
示例4: upDateCheckNameForm
public function upDateCheckNameForm()
{
/*得到课程ID名字加工后即是要找的这张表*/
$course_id = I('course_id');
$check_name_table = "check_name_" . $course_id;
$student_id = I('student_id');
//$data['student_name'] =I('student_name'); 后期再处理
$update = new Model();
$update->execute("update {$check_name_table} set attend_stage='attend' where student_id='{$student_id}' ");
//$update->execute("update $check_name_table set attend_stage='attend' where student_id=$student_id ");
$this->ajaxReturn(1);
}
示例5: result
public function result()
{
//这个id是指 赛事组织配置id
$id = (int) $this->_get('id');
$token = session('token');
$where = " a.token='" . $token . "' and a.id=" . $id . " and a.zhudui=b.id and a.kedui=c.id";
$changci_db = new Model();
$changci = $changci_db->table(C('DB_PREFIX') . "jingcai_changci a," . C('DB_PREFIX') . "jingcai_team b," . C('DB_PREFIX') . "jingcai_team c")->field("a.*,b.name zhuduiname,c.name keduiname")->where($where)->find();
$this->assign('info', $changci);
if (IS_POST) {
$zhuduinum = $this->_post('zhuduinum');
$keduinum = $this->_post('keduinum');
/**
* 给成功竞猜的人增加积分
*/
if ($zhuduinum > $keduinum) {
$type = 3;
} elseif ($zhuduinum == $keduinum) {
$type = 1;
} else {
$type = 2;
}
$Model = new Model();
$score_dtl_sql = "insert into `" . C('DB_PREFIX') . "member_card_sign`(`sign_time`,`is_sign`,`score_type`,`token`,`wecha_id`,`expense`,`score_name`)" . " select '" . time() . "'," . " 1,36,token,wecha_id,sjm,'2333'" . " from `" . C('DB_PREFIX') . "jingcai_changci_record` where `token`='" . $this->token . "' and `changci_id`=" . $id . " and `ycjg`=" . $type . " ";
$Model->execute($score_dtl_sql);
$userinfo_sql = "update `" . C('DB_PREFIX') . "userinfo` a set a.total_score=(select sjm+a.total_score from `" . C('DB_PREFIX') . "jingcai_changci_record` c where c.token='" . $this->token . "' and c.changci_id=" . $id . " and c.ycjg=" . $type . " and a.wecha_id=c.wecha_id )" . " where `token`='" . $this->token . "' and exists (select 1 from `" . C('DB_PREFIX') . "jingcai_changci_record` b where b.token='" . $this->token . "' and b.changci_id=" . $id . " and b.ycjg=" . $type . " and a.wecha_id=b.wecha_id )";
$Model->execute($userinfo_sql);
M('jingcai_changci')->where(array('token' => $token, 'id' => $id))->save(array('zhuduinum' => $zhuduinum, 'keduinum' => $keduinum, 'status' => 1));
$this->success('该赛事已成功结束', U('Jingcai/changci', array('token' => session('token'), 'id' => $changci['type_id'])));
die;
}
$this->display();
}
示例6: delfile
public function delfile($id)
{
$where['id'] = $id;
//删除静态文件
$array = $this->InfoDB->field('id,cid,picurl,title')->where($where)->find();
@unlink('./' . C('upload_path') . '/' . $array['picurl']);
if (C('url_html')) {
//删除内容页
@unlink(C('webpath') . get_read_url_dir('info', $array['id'], $array['cid']) . C('html_file_suffix'));
}
//删除专题收录
$rs = new Model();
$rs->execute("update " . C('db_prefix') . "special set aids=Replace(Replace(Replace(Replace\n\t\t\t(CONCAT(',,',aids,',,'),',{$id},',','),',,,,',''),',,,',''),',,','')");
//
$this->InfoDB->where($where)->delete();
}
示例7: insert
public function insert()
{
if ($_POST['address'] == null) {
$this->error('请先填写地址哦亲');
}
if ($_POST['address'] == 0) {
if ($_POST['new_address'] == null || $_POST['receiver'] == null || $_POST['phone'] == null || $_POST['zipcode'] == null) {
$this->error("请填写详细的新地址");
}
$data['uid'] = $_SESSION['user']['id'];
$data['area'] = $_POST['s_province'] . $_POST['s_city'] . $_POST['s_county'];
$data['address'] = $_POST['new_address'];
$data['receiver'] = $_POST['receiver'];
$data['phone'] = $_POST['phone'];
$data['zipcode'] = $_POST['zipcode'];
$address = M("address");
$result = $address->add($data);
if ($result) {
$ordergoods = $_POST['cartgoods'];
$ordergoodsid = implode(',', $ordergoods);
$c = M("cart");
$goodsnum = $c->where("uid={$_SESSION['user']['id']} and gid in ({$ordergoodsid})")->select();
foreach ($goodsnum as $key => $value) {
$ordergoodsnum[] = $value['num'];
}
$ordergoodsnum = implode(',', $ordergoodsnum);
$name = time();
$time = time();
$data['name'] = $name;
$data['user_id'] = $_SESSION['user']['id'];
$data['goods_id'] = $ordergoodsid;
$data['address_id'] = $result;
$data['goods_num'] = $ordergoodsnum;
$data['time'] = $time;
$data['price'] = $_POST['ordertotalprice'];
$o = M("order");
$order = $o->add($data);
$c = M("cart");
if ($order > 0) {
//如果下单成功 则删除购物车的商品
$delgoods = $c->execute("delete from qd_cart where gid in ({$ordergoodsid})");
$reserveid = explode(',', $ordergoodsid);
$reservenum = explode(',', $ordergoodsnum);
foreach ($reserveid as $key => $value) {
$result = $c->execute("update qd_goods set reserve=reserve-{$reservenum[$key]} where id={$value}");
}
$this->success("下单成功", "__APP__/Showcart/index");
} else {
$this->error("加入订单失败");
}
}
} else {
$ordergoods = $_POST['cartgoods'];
$ordergoodsid = implode(',', $ordergoods);
$c = M("cart");
$goodsnum = $c->where("uid={$_SESSION['user']['id']} and gid in ({$ordergoodsid})")->select();
foreach ($goodsnum as $key => $value) {
$ordergoodsnum[] = $value['num'];
}
$ordergoodsnum = implode(',', $ordergoodsnum);
$addressid = $_POST['address'];
$name = time();
$time = time();
$data['name'] = $name;
$data['user_id'] = $_SESSION['user']['id'];
$data['goods_id'] = $ordergoodsid;
$data['address_id'] = $addressid;
$data['goods_num'] = $ordergoodsnum;
$data['time'] = $time;
$data['price'] = $_POST['ordertotalprice'];
$o = M("order");
$order = $o->add($data);
$c = new Model();
if ($order > 0) {
//如果下单成功 则删除购物车的商品
$delgoods = $c->execute("delete from qd_cart where gid in ({$ordergoodsid})");
$reserveid = explode(',', $ordergoodsid);
$reservenum = explode(',', $ordergoodsnum);
foreach ($reserveid as $key => $value) {
$result = $c->execute("update qd_goods set reserve=reserve-{$reservenum[$key]} where id={$value}");
}
$this->success("下单成功", "__APP__/Showcart/index");
} else {
$this->error("加入订单失败");
}
}
}
示例8: delfile
public function delfile($id)
{
//删除静态文件
$array = $this->VideoDB->field('id,cid,picurl,title,playurl')->where('id = ' . intval($id))->find();
@unlink('./' . C('upload_path') . '/' . $array['picurl']);
@unlink('./' . C('upload_path') . '-s/' . $array['picurl']);
if (C('url_html')) {
//删除内容页
@unlink(C('webpath') . get_read_url_dir('video', $array['id'], $array['cid']) . C('html_file_suffix'));
//删除播放页
if (C('url_html_play')) {
$count = 1;
if (C('url_html_play') == 2) {
$count = $this->playlist($array['playurl'], $array['id'], $array['cid']);
$count = $count[0]['playcount'];
}
for ($i = 0; $i < $count; $i++) {
$dirurl = get_play_url_dir($array['id'], $array['cid'], $i) . C('html_file_suffix');
@unlink($dirurl);
}
}
}
//删除专题收录
$rs = new Model();
$rs->execute("update " . C('db_prefix') . "special set mids=Replace(Replace(Replace(Replace\n\t\t\t(CONCAT(',,',mids,',,'),',{$id},',','),',,,,',''),',,,',''),',,','')");
//删除影片ID
$where['id'] = $id;
$this->VideoDB->where($where)->delete();
unset($where);
//删除观看主录
$where['did'] = $id;
$this->UserVDB->where($where)->delete();
unset($where);
//删除相关评论
$where['did'] = $id;
$where['mid'] = 1;
$this->CommDB->where($where)->delete();
}
示例9: save
public function save()
{
$sql = "UPDATE tice_config SET\n schoolType = {$this->schoolType},\n beginRow = {$this->beginRow},\n dataSheetNum = '{$this->dataSheetNum}',\n column1 = '{$this->column1}',column2 = '{$this->column2}',column3 = '{$this->column3}',column4 = '{$this->column4}',column5 = '{$this->column5}',\n column6 = '{$this->column6}',column7 = '{$this->column7}',column8 = '{$this->column8}',column9 = '{$this->column9}',column10 = '{$this->column10}',\n column11 = '{$this->column11}',column12 = '{$this->column12}',column13 = '{$this->column13}',column14 = '{$this->column14}',column15 = '{$this->column15}',\n column16 = '{$this->column16}',column17 = '{$this->column17}',column18 = '{$this->column18}',column19 = '{$this->column19}',column20 = '{$this->column20}',\n column21 = '{$this->column21}',column22 = '{$this->column22}',column23 = '{$this->column23}',column24 = '{$this->column24}',column25 = '{$this->column25}',\n column26 = '{$this->column26}',column27 = '{$this->column27}',column28 = '{$this->column28}',column29 = '{$this->column29}',column30 = '{$this->column30}',\n column31 = '{$this->column31}',column32 = '{$this->column32}',column33 = '{$this->column33}',column34 = '{$this->column34}',column35 = '{$this->column35}',\n column36 = '{$this->column36}',column37 = '{$this->column37}',column38 = '{$this->column38}',column39 = '{$this->column39}',column40 = '{$this->column40}',\n column41 = '{$this->column41}',column42 = '{$this->column42}',column43 = '{$this->column43}',column44 = '{$this->column44}',column45 = '{$this->column45}',\n column46 = '{$this->column46}',column47 = '{$this->column47}',column48 = '{$this->column48}',column49 = '{$this->column49}',column50 = '{$this->column50}',\n column51 = '{$this->column51}',column52 = '{$this->column52}',column53 = '{$this->column53}',column54 = '{$this->column54}',column55 = '{$this->column55}',\n column56 = '{$this->column56}',column57 = '{$this->column57}',modifyTime = NOW()\n ";
// print_r($sql);
return parent::execute($sql);
}
示例10: elseif
print $jsonarray;
}
} elseif (isset($_POST["php_title"]) && $_POST["php_operate"] === 'qu-cat') {
$id = $_POST['php_id'];
$title = $_POST['php_title'];
$describe = $_POST['php_describe'];
$conn = new Connection();
$model = new Model();
$sql = "UPDATE category SET title = '" . $title . "',describe_cat = '" . $describe . "' \n\t\t\t\tWHERE id = " . $id . ";";
$result = $model->execute($sql);
if (!$result) {
die("Database query failed.");
} else {
$rows = $model->select('SELECT * FROM category');
$jsonarray = json_encode($rows);
print $jsonarray;
}
} elseif (isset($_POST["php_id"]) && $_POST["php_operate"] === 'qd-cat') {
$id = $_POST['php_id'];
$conn = new Connection();
$model = new Model();
$sql = "DELETE FROM category WHERE id = " . $id . ";";
$result = $model->execute($sql);
if (!$result) {
die("Database query failed.");
} else {
$rows = $model->select('SELECT * FROM category');
$jsonarray = json_encode($rows);
print $jsonarray;
}
}
示例11: resetPasswd
public function resetPasswd()
{
$sql = "UPDATE tice_user SET password = '{$this->password}' WHERE stuId = {$this->stuId} LIMIT 1";
return parent::execute($sql);
}
示例12: article
public function article()
{
$model = D("Archives");
$id = $_REQUEST["id"];
$vo = $model->where("id = " . $id)->find();
if ($vo['arcrank'] == "-1") {
$this->error('文档未审核!', C("site_url"));
}
//click+1
$Model = new Model();
$Model->execute("UPDATE " . C("DB_PREFIX") . "archives SET click=click+1 WHERE id=" . $id);
$model = M("Addon" . $vo['channel']);
$vo1 = $model->where("aid = " . $id)->find();
if (empty($vo1)) {
$vo1 = array();
}
$result = array_merge($vo, $vo1);
$this->assign('vo', $result);
$type = M("Arctype")->where("id=" . $vo['typeid'])->find();
$this->assign('type', $type);
$this->display(str_replace(".html", "", $type['temparticle']));
}
示例13: time
/**
*记录关键字
*@date 2010-10-29
*@time 上午10:45:24
*/
function _so_key($key)
{
//记录关键字
$time = time();
$sql = "INSERT INTO `iic_so_key` (`id` ,`keyword` ,`ctime` ,`mtime` ,`hot`) VALUES (NULL , '{$key}', '{$time}', '{$time}', '0') ON DUPLICATE KEY UPDATE `mtime` = '{$time}', `hot`=`hot`+1;";
$m = new Model();
return $m->execute($sql);
}
示例14: enterprise_user_management_ajaxpost
public function enterprise_user_management_ajaxpost()
{
// $A=1;
// $ans=json_encode($A);
// $this->ajaxReturn( "shibai");
$munit = M('user');
$userid = I('post.user_id');
$type = I('post.usertype');
if (I('post.action') == "lock") {
if (I('post.value') == '0') {
$data['lock'] = '0';
} else {
$data['lock'] = '1';
}
$result = $munit->where(array('user_id' => I('post.user_id')))->save($data);
if ($result) {
$ans = json_encode("成功");
$this->ajaxReturn($ans, 'JSON');
} else {
$ans = json_encode("失败");
$this->ajaxReturn($ans, 'JSON');
}
// $this->show( "lock_ok".I( 'post.user_id' ) );
} else {
if (I('post.action') == "verify") {
$result = $munit->where("user_id='{$userid}'")->setField('is_verify', 1);
if ($result > 0) {
if ($type == 5) {
$prefix = "production_unit";
} else {
if ($type == 7) {
$prefix = "reception_unit";
} else {
$ans = json_encode("成功");
$this->ajaxReturn($ans, 'JSON');
}
}
$mx = M($prefix)->where("user_id='{$userid}'")->getField($prefix . '_id');
$tablename = $prefix . "_" . $mx;
if ($prefix == "production_unit") {
$sql = 'create table ' . $tablename . ' (
id int(11) NOT NULL AUTO_INCREMENT,
rfid_id varchar(255) DEFAULT NULL,
waste_category_id int(11) DEFAULT NULL,
add_weight double DEFAULT NULL,
add_date_time datetime DEFAULT NULL,
add_num int(11) DEFAULT NULL,
android_num varchar(255) DEFAULT NULL,
PRIMARY KEY (id),
KEY fk_waste_category_id_' . $tablename . ' (waste_category_id) USING BTREE,
CONSTRAINT fk_waste_category_id_' . $tablename . ' FOREIGN KEY (waste_category_id) REFERENCES waste_category (waste_category_id)
)';
} else {
$sql = 'create table ' . $tablename . ' (
id int(11) NOT NULL AUTO_INCREMENT,
rfid_id varchar(255) DEFAULT NULL,
waste_category_id int(11) DEFAULT NULL,
total_weight double DEFAULT NULL,
receive_date_time datetime DEFAULT NULL,
total_num int(11) DEFAULT NULL,
android_num varchar(255) DEFAULT NULL,
PRIMARY KEY (id),
KEY fk_waste_category_id_' . $tablename . ' (waste_category_id) USING BTREE,
CONSTRAINT fk_waste_category_id_' . $tablename . ' FOREIGN KEY (waste_category_id) REFERENCES waste_category (waste_category_id)
)';
}
$model = new Model();
$model->execute($sql);
$num = M('information_schema.tables')->where("table_schema = 'dwms'\n\t\t\t\t\t\t\tAND table_name = '{$tablename}'")->count();
if ($num > 0) {
$ans = json_encode("成功");
$this->ajaxReturn($ans, 'JSON');
} else {
$ans = json_encode("创建数据库出现错误");
$this->ajaxReturn($ans, 'JSON');
}
} else {
$ans = json_encode("未知错误");
$this->ajaxReturn($ans, 'JSON');
}
// $this->show( "verify_ok".I( 'post.user_id' ) );
} else {
$this->error("action_error");
}
}
}
示例15: delGroup
public function delGroup($id = 0)
{
if ($id) {
$where = "group_id =" . $id;
} else {
$this->error("请选择用户组");
}
$where['catpid'] = array('like', '%' . $id . '%');
$where['id'] = array('eq', $id);
$where['_logic'] = 'or';
$mod = D("Commision");
$moduc = D("user_commision");
$list = $mod->where($where)->select();
$delList = array();
//删除id列表
$upUser = array();
//site_add删除id列表
foreach ($list as $k => $v) {
array_push($delList, $v['id']);
}
$list2 = $moduc->where("id in (" . $delList . ")")->select();
foreach ($list2 as $k => $v) {
array_push($upUser, $v['uid']);
}
$ret1 = $mod->where(array('id' => array('in', $delList)))->delete();
$ret2 = $moduc->where(array('group_id' => array('in', $delList)))->delete();
if ($ret1 && $ret2) {
$Model = new Model();
$sql = "update ds_user set uid = 0 where id in(" . $upUser . ")";
$Model->execute($sql, false);
$this->success('删除成功');
} elseif ($ret1 && !$ret2) {
$this->success('分组删除成功,分组与用户对应关系删除失败,请手动删除');
} elseif (!$ret1 && $ret2) {
$this->success(',分组与用户对应关系删除成功,分组删除失败,请手动删除');
}
}