[求助]恳请大家帮忙看看关于array/object的报错 |
今日又来求助,请多多帮忙!
后台运行时报错如下:
Warning: reset(): Passed variable is not an array or object in D:\Program Files\Apache Group\Apache2\htdocs\catalog\admin\includes\classes\object_info.php on line 17
Warning: Variable passed to each() is not an array or object in D:\Program Files\Apache Group\Apache2\htdocs\catalog\admin\includes\classes\object_info.php on line 18
我想是传递变量不是要求的数组或者对象,于是我在相应文件中查找,但我觉得传递过去的好像是数组啊,大家帮帮忙,谢谢!
下面是涉及到的函数定义
[php]
<?php
class objectInfo {
// class constructor
function objectInfo($object_array) {
reset($object_array);
while (list($key, $value) = each($object_array)) {
$this->$key = tep_db_prepare_input($value);
}
}
}
?>
[/php]
下面是用到objectInfo类的几处地方(以标号显示):
[php]
1. $cInfo = new objectInfo($HTTP_POST_VARS);
2. $customers_query = tep_db_query("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, cd.classification_name, cc.classification_id,c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS_CLASSIFICATION . " cc," . TABLE_CUSTOMERS_CLASSIFICATION_DESCRIPTION . " cd, " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.classification_id = cd.classification_id and cd.classification_id = cc.classification_id and c.customers_id = '" . (int)$HTTP_GET_VARS['cID'] . "'");
$customers = tep_db_fetch_array($customers_query);
$cInfo = new objectInfo($customers);
3. $classification_query = tep_db_query("select c.classification_id, cd.classification_name, c.parent_id, c.date_added, c.date_modified from " . TABLE_CUSTOMERS_CLASSIFICATION . " c, " . TABLE_CUSTOMERS_CLASSIFICATION_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_classification_id . "' and c.classification_id = cd.classification_id and cd.language_id = '" . (int)$languages_id . "' order by cd.classification_name");
$classification = tep_db_fetch_array($classification_query)
$classification_childs = array('childs_count' => tep_childs_in_classification_count($classification['classification_id']));
$classification_customers = array('customers_count' => tep_customers_in_classification_count($classification['classification_id']));
$ccInfo_array = array_merge($classification, $classification_childs, $classification_customers);
$ccInfo = new objectInfo($ccInfo_array);
4. $customers_query = tep_db_query("select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id, c2c.classification_id from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " a, " . TABLE_CUSTOMERS_TO_CLASSIFICATION . " c2c where c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id and c.customers_id = c2c.customers_id and c2c.classification_id = '" .(int) $current_classification_id . "' order by c.customers_lastname, c.customers_firstname");
$customers = tep_db_fetch_array($customers_query)
$info_query = tep_db_query("select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers['customers_id'] . "'");
$info = tep_db_fetch_array($info_query);
$country_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$customers['entry_country_id'] . "'");
$country = tep_db_fetch_array($country_query);
$reviews_query = tep_db_query("select count(*) as number_of_reviews from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers['customers_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
$customer_info = array_merge($country, $info, $reviews);
$cInfo_array = array_merge($customers, $customer_info);
$cInfo = new objectInfo($cInfo_array);
[/php]
|
|
|