🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
### 常用表说明 ~~~ ims_mc_mapping_fans 粉丝表 ims_mc_members 会员表 ~~~ ### 数据库操作函数 ~~~ 表名 tablename('mc_members') 查询一条数据 pdo_get('yoby_demo',['id'=>1]); pdo_get('yoby_demo',['id'=>1],['title','num']);返回特定字段 pdo_get('yoby_demo',[],['count(*) as z','title','num','max(num)']); pdo_fetch("SELECT username, uid FROM ".tablename('users')." WHERE uid = :uid LIMIT 1", array(':uid' => 1)); 查询单字段 pdo_getcolumn('yoby_demo',['id'=>1],'title'); pdo_fetchcolumn("SELECT COUNT(*) FROM ".tablename('users')); 查询多条记录 表名,条件,返回字段,主键,排序,限制条数 pdo_getall('yoby_demo',[],[],'','id desc','.($pindex-1)* $psize.','.$psize); pdo_fetchall("SELECT username, uid FROM ".tablename('users'), []); 插入数据,第二个参数数组 pdo_insert('yoby_demo',[]); $id = pdo_insertid();插入id 修改 pdo_update('yoby_demo',['num +='=>1],['id'=>1]); 删除 pdo_delete('yoby_demo',['id'=>1]); pdo_delete($this->table_reply, "id IN ('".implode("','", $deleteid)."')"); 执行sql pdo_query("DELETE FROM ".tablename('users')." WHERE uid = :uid", array(':uid' => 2)); 支持多条sql用分号隔开 pdo_run($sql); 显示调试语句 pdo_debug(); 检测某个字段是否存在 pdo_fieldexists('shopping_goods', 'credit'); 检测某个表是否存在 pdo_tableexists($tablename) 检测表是否为空 pdo_exists($tb) 获取数据条数 pdo_count($tb,['id'=>1])