时间:2021-07-01 10:21:17 帮助过:14人阅读
分享到:
public static function query($sql, $unbuffered = false) {
$ret = self::$db->query($sql, $unbuffered);//该句成功时$ret为1 注::self::$db->query为mysql_query
if ($unbuffered===true) {
$cmd = trim(strtoupper(substr($sql, 0, strpos($sql, ' '))));
if ($cmd === 'SELECT') { }
elseif ($cmd === 'UPDATE' || $cmd === 'DELETE') {
$ret = self::$db->affected_rows();
}
elseif ($cmd === 'INSERT') {
$ret = self::$db->insert_id();//该处运行时证明执行了,返回的是int类型id号
}
}
return $ret;//最终返回不是int类型id号
}