Home > Backend Development > PHP Tutorial > 为什么fetch_array() 得不到数据?该如何解决

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:41:22
Original
1093 people have browsed it

为什么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>
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
Latest Issues
Why is this ID written like this?
From 1970-01-01 08:00:00
0
0
0
Small question about $this
From 1970-01-01 08:00:00
0
0
0
What's the use of this?
From 1970-01-01 08:00:00
0
0
0
This file demo.mp4
From 1970-01-01 08:00:00
0
0
0
javascript - es6中this
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template