我有一個非常奇怪的錯誤:在PHP中可捕獲的錯誤?
[04-Jun-2010 15:55:32] PHP Catchable fatal error: Object of class Type could not be converted to string in /home/prettykl/public_html/2010/includes/functions.php on line 140
這是代碼和行140是$ SQL線。
if (!empty($type)) {
$sql = "SELECT * FROM `types` WHERE `type` = '$type'";
$dbi = new db();
$result = $dbi->query($sql);
$row = mysql_fetch_row($result);
$dbi->closeLink();
$where_array[] = "`typeID` = '".$row->typeID."'";
$where_array[] = "`typeID2` = '".$row->typeID."'";
}
我有5或6班,我從來沒有遇到過這個問題。 函數沒有參考類,任何想法?
謝謝,
的Stefan
另外使用print_r($ type)來查明它實際是什麼 – 2010-06-04 15:08:33
$ type必須是Type的一個實例,如錯誤狀態。 – nuqqsa 2010-06-04 15:14:17