数据库使用说明
配置:
$link = array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'haha',
);
基础使用操作
$obj=new MyClass($link);
//sql获取
$obj->getAll("select * from test")
//设置表名
$obj->D('test');
//设置查询字段
$obj->field(array('id','name','sex'));
//设置条件
$obj->where(array('id'=>17));
//分组设置
$obj->group('hehe');
//Order
$obj->order(array('id'=>'desc') );
//limit
$obj->limit('1,10');
//查询
$obj->All()
$obj->delete();
$data = array('add_time'=>time(),'name'=>'呵呵','age'=>20,'sex'=>'2');
$obj->insert($data);
$obj->where();
echo $obj->where;
var_dump( $obj->update($data) );
echo $obj->getLastsql();
$obj->sql="select * from test";
$rows=$obj->query();
if($rows){
var_dump($rows);
}else{
print $obj->lasError;
}
链表:
ps :别忘记alias/setAlias 一下
* 用法 一
$join = [
['LEFT JOIN tbl_speciality b','a.speciality_id = b.id'],
];
* 用法 二
*->join('LEFT JOIN tbl_speciality as b on a.speciality_id = b.id');