0
我正在使用預準備語句和MySQLi,並且當前正在收到此錯誤。MySQLi可捕獲的致命錯誤
PHP Catchable fatal error: Object of class mysqli_stmt could not be converted to string in /Users/me/path/to/project/ModelBase/City.php on line 31
它是從(全功能)來驗證碼:
function select($query, $limit)
{
$query = "%".$query."%";
$con = ModelBase::getConnection();
$sql = "SELECT name FROM cities WHERE name LIKE ? LIMIT ?";
$query = $con->prepare($sql) or die("Error preparing sql in City ".parent::$db_conn->error);
$query->bind_param("si", $query, $limit) or die("Error binding params in City ".parent::$db_conn->error);
$query->execute() or die("Error executing query in City");
$tmp = "";
$res = $query->bind_result($tmp);
while($query->fetch());
{
$citylist[] = $tmp;
}
$query->close();
}
像31是$查詢 - >執行()。我找不到任何有關這方面的信息,這與我構建的其他系統的語法幾乎完全相同,從來沒有遇到過這個問題。
在所有愚蠢的簡單的事情,謝謝。 – 2010-03-03 20:53:36