query使用

1.row_array():返回查询结果中的第一条数据

include APP_PATH . "../mysql.class.php";
$db = new mysql();
$sql ="select userid,appid,appsecret,authfields,authfilters,loanid,finid,apitype from boc_user_api where appid='$appid'";
$memberinfo = $db->row_array($sql);

2.result_array():以数组的形式返回所有的查询结果

include APP_PATH . "../mysql.class.php";
$db = new mysql();
$sql ="select userid,appid,appsecret,authfields,authfilters,loanid,finid,apitype from boc_user_api where appid='$appid'";
$memberinfo = $db->result_array($sql);

 3.query():执行非查询之外的sql语句

include APP_PATH . "../mysql.class.php";
$db = new mysql();
$sql ="insert into user (name,age) values ('花花',18)";
$ret = $db->query($sql);

 

posted on 2018-07-10 16:05  薇薇123456  阅读(4552)  评论(0编辑  收藏  举报

导航