2011-03-11 84 views
0

「函數名稱必須是字符串錯誤」消息的含義是什麼?致命錯誤:函數名稱必須是字符串

Fatal error: Function name must be a string in /home/speedycm/public_html/speedyautos/admincp/admincar_cls.php on line 222

線190-222在admincar_cls.php寫着:

$this->_db->query($sql); 

if ($this->_db->num_rows()) 
{ 
    $rows = $this->_db->_fetch_row('DB_FETCH_ASSOC'); 
    $this->ownername = $rows['ownername']; 
    $this->owner_email = $rows['owner_email']; 
    $this->city = $rows['city']; 
    $this->state_id = $rows['state_id']; 
    //$this->caption=$rows[caption]; 
    $this->car_features = stripslashes($rows['features']); 
    $this->year = $rows['year']; 
    $this->make = $rows['make']; 
    $this->model = $rows['model']; 
    $this->color = $rows['color']; 
    $this->seller = $rows['userid']; 
    $this->dateadded = date("m/d/Y", $rows['date_added']); 
    $this->miles = $rows['miles']; 
    $this->city = $rows['city']; 
    $this->state = $rows['state_name']; 
    $this->owner_id = $rows['owner_id']; 
    $this->cstatus = $rows['cstatus']; 
    $this->trans = $rows['trans']; 
    $this->fuel = $rows['fuel']; 
    $this->drive = $rows['drive']; 
    $this->engine = $rows['engine']; 
    $this->vin = $rows['vin']; 
    $this->stocknum = $rows['stocknum']; 
    $this->hit_cnt = $rows['hit_cnt']; 
    $this->is_sold = $rows['is_sold']; 
    $this->country_name = $rows['country_name']; 
    $this->price = number_format($rows['price'], 2, '.', ','); 
    $this->showprice = CURRENCY . number_format($rows['price'], 2, '.', ','); 
    $this->expiry_date = date("m/d/Y", $rows['expiry_date']); 
+4

我們可以在這行之前和之後有更多的代碼嗎? – mauris 2011-03-11 04:18:58

+0

這意味着你不小心使用了類似'$ function()'的東西,函數名前加了'$',其中'$ function'沒有被定義或者不對應一個字符串。雖然我在這裏看不到這樣的事情...... – BoltClock 2011-03-11 04:19:23

+2

另一個常見的罪魁禍首是偶然使用圓括號代替數組索引。 – 2011-03-11 04:20:41

回答

1

我敢打賭,

$rows = $this->_db->_fetch_row('DB_FETCH_ASSOC'); 

應該

$rows = $this->_db->fetch_row('DB_FETCH_ASSOC'); 

我不知道你的數據庫類,但如果query()和num_rows()不啓動機智h是下劃線,fetch_row()可能不應該。雖然不會解釋行號,但...

0

* $ this-> showprice = CURRENCY。 number_format($ rows ['price'],2,'。',','); *

Concating一個定義可能會導致一些奇怪的行爲,也許這是它出現問題的地方?

相關問題