可能重复:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in selectMysql数据库连接错误
这是我的代码,我正在通过对象和类连接数据库。
$this->db_connection($app_config['database']);
$this->table_name = $app_config['database']['tbl_prefix'].strtolower(get_class($this));
$column_q = $this->query("SHOW COLUMNS FROM {$this->table_name}");
while($rows = mysql_fetch_array($column_q)){ #error showing in this line
$column[] = $rows['Field'];
if($rows['Field'] == 'PRI'){
$this->primary_key = $rows['Field'];
}
}
它显示出一些错误,如
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
可以有一个人告诉我什么是错误,以及如何解决这一问题?
一个生活在错误之上,您的查询失败并返回FALSE。所以var保持FALSE,这是你给mysql_fetch_array的 – Rufinus 2011-06-07 12:31:51