Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/topic.php on line 737
Форумы портала PHP.SU :: Помогите!Никак не могу справиться с ошибкой!

 PHP.SU

Программирование на PHP, MySQL и другие веб-технологии
PHP.SU Портал     На главную страницу форума Главная     Помощь Помощь     Поиск Поиск     Поиск Яндекс Поиск Яндекс     Вакансии  Пользователи Пользователи


 Страниц (1): [1]   

> Без описания
bondjames25
Отправлено: 03 Января, 2016 - 17:03:05
Post Id


Новичок


Покинул форум
Сообщений всего: 1
Дата рег-ции: Янв. 2016  


Помог: 0 раз(а)




Возникает ошибка, никак не могут справиться! Помогите, пожалуйста... Огорчение

Strict Standards: Declaration of Product::get() should be compatible with that of GlobalClass::get() in C:\OpenServer\domains\www[dot]loc\lib\product_class.php on line 150

PHP:
скопировать код в буфер обмена
  1.  
  2.  
  3. <?PHP
  4. require_once "global_class.php";
  5.  
  6. class Product extends GlobalClass {
  7.        
  8.         public function __construct() {
  9.                 parent::__construct("products");
  10.         }
  11.        
  12.         public function getAllData($count) {
  13.                 return $this->transform($this->getAll("date", false, $count));
  14.         }
  15.        
  16.         public function getAllTable() {
  17.                 return $this->getAll("id");
  18.         }
  19.        
  20.         public function getTableData($section_table, $count, $offset) {
  21.                 $l = $this->getL($count, $offset);
  22.                 $query = "SELECT `".$this->table_name."`.`id`,
  23.                 `".$this->table_name."`.`section_id`,
  24.                 `".$this->table_name."`.`img`,
  25.                 `".$this->table_name."`.`title`,
  26.                 `".$this->table_name."`.`price`,
  27.                 `".$this->table_name."`.`year`,
  28.                 `".$this->table_name."`.`country`,
  29.                 `".$this->table_name."`.`director`,
  30.                 `".$this->table_name."`.`play`,
  31.                 `".$this->table_name."`.`cast`,
  32.                 `".$this->table_name."`.`description`,
  33.                 `".$this->table_name."`.`date`,
  34.                 `$section_table`.`title` as `section`
  35.                 FROM `".$this->table_name."`
  36.                 INNER JOIN `$section_table` ON `$section_table`.`id` = `".$this->table_name."`.`section_id`
  37.                 ORDER BY `date` DESC $l";
  38.                 return $this->transform($this->db->select($query));
  39.         }
  40.        
  41.         protected function transformElement($product) {
  42.                 $product["img"] = $this->config->address.$this->config->dir_img_products.$product["img"];
  43.                 $product["link"] = $this->url->product($product["id"]);
  44.                 $product["link_cart"] = $this->url->addCart($product["id"]);
  45.                 $product["description"] = str_replace("\n", "<br />", $product["description"]);
  46.                 $product["link_delete"] = $this->url->deleteCart($product["id"]);
  47.                 $product["link_admin_edit"] = $this->url->adminEditProduct($product["id"]);
  48.                 $product["link_admin_delete"] = $this->url->adminDeleteProduct($product["id"]);
  49.                 $product["date"] = $this->format->date($product["date"]);
  50.                 return $product;
  51.         }
  52.        
  53.         private function checkSortUp($sort, $up) {
  54.                 return ((($sort === "title") || ($sort === "price")) && (($up === "1") || ($up === "0")));
  55.         }
  56.        
  57.         public function getAllOnSectionID($section_id, $sort, $up) {
  58.                 if (!$this->checkSortUp($sort, $up)) return $this->transform($this->getAllOnField("section_id", $section_id));
  59.                 return $this->transform($this->getAllOnField("section_id", $section_id, $sort, $up));
  60.         }
  61.        
  62.         public function getAllSort($sort, $up, $count) {
  63.                 if (!$this->checkSortUp($sort, $up)) return $this->getAllData($count);
  64.                 $l = $this->getL($count, 0);
  65.                 $desc = "";
  66.                 if (!$up) $desc = "DESC";
  67.                 $query = "SELECT * FROM
  68.                         (SELECT * FROM `".$this->table_name."` ORDER BY `date` DESC $l) a
  69.                         ORDER BY `$sort` $desc";
  70.                 return $this->transform($this->db->select($query));
  71.         }
  72.        
  73.         public function get($id, $section_table) {
  74.                 if (!$this->check->id($id)) return false;
  75.                 $query = "SELECT `".$this->table_name."`.`id`,
  76.                 `".$this->table_name."`.`section_id`,
  77.                 `".$this->table_name."`.`img`,
  78.                 `".$this->table_name."`.`title`,
  79.                 `".$this->table_name."`.`price`,
  80.                 `".$this->table_name."`.`year`,
  81.                 `".$this->table_name."`.`country`,
  82.                 `".$this->table_name."`.`director`,
  83.                 `".$this->table_name."`.`play`,
  84.                 `".$this->table_name."`.`cast`,
  85.                 `".$this->table_name."`.`description`,
  86.                 `$section_table`.`title` as `section`
  87.                 FROM `".$this->table_name."`
  88.                 INNER JOIN `$section_table` ON `$section_table`.`id` = `".$this->table_name."`.`section_id`
  89.                 WHERE `".$this->table_name."`.`id` = ".$this->config->sym_query;
  90.                 return $this->transform($this->db->selectRow($query, array($id)));
  91.         }
  92.        
  93.         public function getAllOnIDs($ids) {
  94.                 $query_ids = "";
  95.                 $params = array();
  96.                 for ($i = 0; $i < count($ids); $i++) {
  97.                         $query_ids .= $this->config->sym_query.",";
  98.                         $params[] = $ids[$i];
  99.                 }
  100.                 $query_ids = substr($query_ids, 0, -1);
  101.                 $query = "SELECT * FROM `".$this->table_name."` WHERE `id` IN ($query_ids)";
  102.                 return $this->transform($this->db->select($query, $params));
  103.         }
  104.        
  105.         public function getPriceOnIDs($ids) {
  106.                 $products = $this->getAllOnIDs($ids);
  107.                 $result = array();
  108.                 for ($i = 0; $i < count($products); $i++) {
  109.                         $result[$products[$i]["id"]] = $products[$i]["price"];
  110.                 }
  111.                 $summa = 0;
  112.                 for ($i = 0; $i < count($ids); $i++) {
  113.                         $summa += $result[$ids[$i]];
  114.                 }
  115.                 return $summa;
  116.         }
  117.        
  118.         public function getOthers($product_info, $count) {
  119.                 $l = $this->getL($count, 0);
  120.                 $query = "SELECT * FROM `".$this->table_name."` WHERE `section_id`=".$this->config->sym_query." AND `id` != ".$this->config->sym_query." ORDER BY RAND() $l";
  121.                 return $this->transform($this->db->select($query, array($product_info["section_id"], $product_info["id"])));
  122.         }
  123.        
  124.         public function getDate($id) {
  125.                 return $this->getFieldOnID($id, "date");
  126.         }
  127.        
  128.         public function getImg($id) {
  129.                 return $this->getFieldOnID($id, "img");
  130.         }
  131.        
  132.         public function search($q, $sort, $up) {
  133.                 if (!$this->checkSortUp($sort, $up)) return $this->transform(parent::search($q, array("title", "country", "year", "director", "cast", "description")));
  134.                 return $this->transform(parent::search($q, array("title", "country", "year", "director", "cast", "description"), $sort, $up));
  135.         }
  136.        
  137.         protected function checkData($data) {
  138.                 if (!$this->check->id($data["section_id"])) return "UNKNOWN_ERROR";
  139.                 if (!$this->check->title($data["title"])) return "ERROR_TITLE";
  140.                 if (!$this->check->amount($data["price"])) return "ERROR_PRICE";
  141.                 if (!$this->check->year($data["year"])) return "ERROR_YEAR";
  142.                 if (!$this->check->title($data["country"])) return "ERROR_COUNTRY";
  143.                 if (!$this->check->title($data["director"])) return "ERROR_DIRECTOR";
  144.                 if (!$this->check->play($data["play"])) return "ERROR_PLAY";
  145.                 if (!$this->check->text($data["cast"])) return "ERROR_CAST";
  146.                 if (!$this->check->text($data["description"])) return "ERROR_DESCRIPTION";
  147.                 if (!$this->check->title($data["img"])) return "ERROR_IMG";
  148.                 if (!$this->check->ts($data["date"])) return "UNKNOWN_ERROR";
  149.                 return true;
  150.         }
  151.  
  152. }
  153.  
  154. ?>
  155.  
 
 Top
DelphinPRO
Отправлено: 04 Января, 2016 - 13:20:31
Post Id



Активный участник


Покинул форум
Сообщений всего: 7187
Дата рег-ции: Февр. 2012  


Помог: 353 раз(а)




Что там справляться? ясно же написано - объявление метода get() в классе Product должно быть таким же, как и объявление этого же метода в родительском классе GlobalClass.


-----
Чем больше узнаю, тем больше я не знаю.
 
 Top
Nekri
Отправлено: 16 Февраля, 2016 - 22:23:40
Post Id


Новичок


Покинул форум
Сообщений всего: 9
Дата рег-ции: Февр. 2016  


Помог: 0 раз(а)




Постав версию php5.3 на хостингу
 
 Top
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« Если скрипт не работает »


Все гости форума могут просматривать этот раздел.
Только зарегистрированные пользователи могут создавать новые темы в этом разделе.
Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
 



Powered by PHP  Powered By MySQL  Powered by Nginx  Valid CSS  RSS

 
Powered by ExBB FM 1.0 RC1. InvisionExBB