$data['kid']=basKeyid::kidTemp();
$data['kno']='1';
$data['atime']=time();
$data['content']='123abc@q.com';
$db->table('xtest_keyid')->data($data)->insert();
$data['kno']='2';
unset($data['kid']);
$db->table('xtest_keyid')->data($data)->where("kid='2015-cr-f9pt2r7'")->update();
$info=$db->table('Tab-Name')->where($condition)->find();
Returns an array, or returns false
Fields
$info=$db->table('Tab-Name')->field('id,title')->where($condition)->find();
Order
$info=$db->table('Tab-Name')->field('id,title')->where($condition)->order('id desc')->find();
Notice: order('id DESC'), order('id ASC')
Cache
$info=$db->table('Tab-Name')->cache(10)->where($condition)->find();
cache($time) $time>0: Cache time; $time=0: NO-Cache; $time=-1: Permanent cache
$list=$db->table('Tab-Name')->where($condition)->select();
Returns an array, or returns false
Fields
$list=$db->table('Tab-Name')->field('id,title')->where($condition)->select();
Order
$list=$db->table('Tab-Name')->field('id,title')->where($condition)->order('id desc')->select();
Limit
$list=$db->table('Tab-Name')->field('id,title')->where($condition)->order('id desc')->limit(10)->select();
Cache
$list=$db->table('Tab-Name')->cache($time)->field('id,title')->where($condition)->order('id desc')->limit(10)->select();
cache($time) $time>0: Cache time; $time=0: NO-Cache; $time=-1: Permanent cache
$count=$db->table('Tab-Name')->where($condition)->count();
Returns a int number, or returns false
$count=$db->table('Tab-Name')->cache($time)->where($condition)->count();
and
connec more then one conditions
$condition: Condition can be a string or an array, if it is an array, eg: $condition['id']=1;
Returns deleted rows, or returns false
Notice: To prevent accidentally deleted all data from the table, it will not delete anything while $condition is null.
$db->table('xtest_keyid')->where("kid='2015-cr-f9pt2r7'")->delete();
If $sql is the query condition, return array; and the cache can be set up: $db->cache(expire)->query($sql);
If $sql is NOT the query condition, cache settings is NOT invalid.
$db->query($sql);
--- Common code ---
$db->table($tabid)->data(basReq::in($fm))->insert();
$db->table($tabid)->where("kid='$id'")->delete();
$db->table($tabid)->data(array('enable'=>'1'))->where("kid='$id'")->update();
$list = $db->table('base_model')->field('kid,title')->limit(3)->select(); if($list)foreach($list as $r){}}
$fm = $db->table($tabid)->where("model='$mod' AND kid='$kid'")->find();
$count = $db->table('base_model')->where("pid='groups'")->count();
$sql = "SELECT kid,title FROM base_model_ys WHERE pid='groups' LIMIT 3";
$list = $db->arr($sql);
print_r($db->fields('xtest_keyid_ys'));
print_r($db->tables());
$db->
code IN $db->
operation, (Sometimes, it will go wrong.)eg.
$db->table('users_uacc')->data($acc+basSql::logData())->insert(); //
-=> Edit by:
$dataex = basSql::logData();
$db->table('users_uacc')->data($acc+$dataex)->insert();
defect
defects
for the system, please according to the following address: UPDATE users_adminer_ys set uid=concat('2010-4q-',uname)
UPDATE `users_person_ys` b INNER JOIN users_uacc_ys a ON a.uname=b.uname SET b.uid=a.uid;
UPDATE `dede_addonarticle` SET body=REPLACE (body,'</td>',");
Notice: These pages at `/dev.php` is the Manual for Imcat, Welcome to `Faqs` Exchange experience!
QQGroup:607070548; Copyright © 2011-2018 txjia.com All rights reserved.
Run:0.000/20.365(ms); 0(sql)/1.97(MB); doc:c_demo/dev2nd_basic; Upd:2025-01-10 21:17:06