就我对Google和所有内容所做的搜索而言,它看起来像是一个很常见的问题,但似乎无法修复它。另外,我认为我和其他人有不同的用法。 而且,经过大约3个小时的运气,我在这里张贴!mysqli_free_result():mysqli_result类的对象无法转换为字符串
function free_result(){ # LINE 48
$free = "SELECT SHOW DESCRIBE EXPLAIN"; # LINE 49
$free = explode(" ", $free); # LINE 50
$sql = $this->sql; # LINE 51
while(list($key, $value) = each($free)){ # LINE 52
if(preg_match("/\b".$value."\b/", $sql)){ # LINE 53
$result = $this->result; # LINE 54
if(!mysqli_free_result($result)){ # LINE 55
$this->errors("Invalid result: <b>{$result}</b>. Couldn't free result."); # LINE 56
} # LINE 57
} # LINE 58
} # LINE 59
} # LINE 60
# LINE 61
function query($sql){ # LINE 62
$this->query_id = mysqli_query($this->connection, $sql); # LINE 63
$this->result = mysqli_store_result($this->connection); # LINE 64
$this->sql = $sql; # LINE 65
if(!$this->query_id){ # LINE 66
$this->errors("Couldn't query: <b>{$sql}</b>"); # LINE 67
return 0; # LINE 68
} # LINE 69
$this->affected = mysqli_affected_rows($this->connection); # LINE 70
# LINE 71
return $this->query_id; # LINE 72
} # LINE 73
这些是我的数据库类中的2个函数。但我认为只有这2个才能解决问题。
所以,我recieving错误是:
"Warning: mysqli_free_result() expects parameter 1 to be mysqli_result,
boolean given in [file path]\database.class.php on line 55"
#followed by my database class error handling
"Invalid result: . Couldn't free result."
至于我对这个去理解,我觉得现在的问题是$结果变量(54行,64行),但因为这是我对MySQLi的第一次冒险,所以我不太确定。
我希望你能理解这个问题,并且能够提供帮助! 在此先感谢!
谢谢!完美的作品...再次证明简单更好。呵呵。 – jolt 2010-07-16 02:21:20