求问以次方法为何不能得到返回值

WBOY
Release: 2016-06-13 12:47:16
Original
912 people have browsed it

求问以下方法为何不能得到返回值?

本帖最后由 u010416883 于 2013-06-01 11:37:22 编辑 由解,以下疑问!
<br />
public static function query($sql, $unbuffered = false) {<br />
    $ret = self::$db->query($sql, $unbuffered);//该句成功时$ret为1  注::self::$db->query为mysql_query<br />
    if ($unbuffered===true) {<br />
      $cmd = trim(strtoupper(substr($sql, 0, strpos($sql, ' '))));<br />
      if ($cmd === 'SELECT') { } <br />
      elseif ($cmd === 'UPDATE' || $cmd === 'DELETE') {<br />
          $ret = self::$db->affected_rows();<br />
      } <br />
      elseif ($cmd === 'INSERT') {<br />
          $ret = self::$db->insert_id();//该处运行时证明执行了,返回的是int类型id号<br />
      }<br />
   }<br />
   return $ret;//最终返回不是int类型id号<br />
}       <br />
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template