首頁  >  文章  >  後端開發  >  为什么fetch_array() 得不到数据?该如何解决

为什么fetch_array() 得不到数据?该如何解决

WBOY
WBOY原創
2016-06-13 13:41:22991瀏覽

为什么fetch_array() 得不到数据?
function query($sql) {
$this->sql = $sql;
$result = mysql_query($sql,$this->conn) or die(mysql_error());
if (!$result) {
$this->show("错误SQL语句",$sql);
} else {
$this->result = $result;
}
}
function select($table, $columnName = "*", $condition = '') {
$condition = $condition ? ' WHERE ' . $condition : NULL;
$this->query("SELECT $columnName FROM $table $condition");
}
function fetch_array() {
if(!mysql_fetch_array($this->result)){
$this->show("错误执行");
}else{
return mysql_fetch_array($this->result);
}
}

------解决方案--------------------

PHP code
function fetch_array() {
if(! $this->result){
  $this->show("错误执行");
}else{
  return mysql_fetch_array($this->$result);
} <div class="clear">
                 
              
              
        
            </div>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn