ホームページ  >  記事  >  バックエンド開発  >  fetch_array() がデータを取得できないのはなぜですか?解決方法

fetch_array() がデータを取得できないのはなぜですか?解決方法

WBOY
WBOYオリジナル
2016-06-13 13:41:22992ブラウズ

function query($sql) {
$this->sql = $sql;
$result = mysql_query($sql,$this->conn)または die(mysql_error());
if (!$result) {
$this->show("错误SQL语句",$sql);
} else {
$this- >result = $result;
}
}
function select($table, $columnName = "*", $condition = '') {
$condition = $condition ? ' どこ ' 。 $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 コード
関数 fetch_array() {
if(! $this->result){
  $this->show("错误行");
}それ以外{
  return mysql_fetch_array($this->$result);
<div class="clear"></div>
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。