public function clear_str($str){
if(is_array($str)){
$row = array();
foreach($str as $key => $item){
$row[$key] = trim(strip_tags($item));
}
return $row;
}
return trim(strip_tags($str));
}
public function cat_articles($id_cat){
$sql = "SELECT `articles_id`,
`title`,
`keywords`,
`description`,
`date`,
`author`,
`articles_image`,
`short_text`,
`full_text`,
`category_id`,
`visible` FROM `articles` WHERE `category_id` = '{$id_cat}' AND `visible` = '1'";
$result = $this -> ins_db -> query($sql);
if(!$result){
throw new DbException('Ошибка запроса: '.$this -> ins_db -> connect_errno.' | '.$this -> ins_db -> connect_error);
}
if($result -> num_rows === 0) return FALSE;
for($i = 0; $i < $result -> num_rows; $i++){
$row[] = $result -> fetch_assoc();
}
return $row;
}