
Всем привет!
При попытке перейти на страницу и отредактировать с админки какую-либо статью - выдает ошибку:
"Warning: Invalid argument supplied for foreach() in E:\OpenServer\OpenServer\domains\myblog.ru\views\admin\admin_panel.php on line 19"
В этом файле у меня распологается структура админки (вывода статьей):
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AV-Helper.com - Админ-панель</title>
<link rel="stylesheet" href="/views/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h1>Панель управления</h1>
<a href="index.php?action=add">Добавить статью</a>
<table class="admin-table">
<tr>
<th>Дата</th>
<th>Заголовок</th>
<th>Пользователь</th>
</tr>
<?php foreach($articles as $post) : ?>
<tr>
<th><?=$post['date']?></th>
<th><?=$post['title']?></th>
<th><?=$post['author']?></th>
<td>
<a href="index.php?action=edit&id=<?=$post['id']?>">Редактивровать</a>
</td>
<td>
<a href="index.php?action=delete&id=<?=$post['id']?>">Удалить</a>
</td>
</tr>
<?php endforeach ?>
</table>
<?php include("footer.php"); ?>
</div>
</body>
</html>
Что не так прописано?
Сама функция редактирования статьей выглядет следующим образом:
<?php
require_once ("../config.php");
require_once ("../models/articles.php");
$link = db_connect();
if(isset($_GET['action']))
$action = $_GET['action'];
else
$action = "";
if($action == "add"){
if(!empty($_POST)){
articles_new($link, $_POST['title'], $_POST['date'], $_POST['description'], $_POST['img'], $_POST['description'], $_POST['anons'], $_POST['author'], $_POST['category']);
header ("Location: ../admin/index.php");
}else
include ("../views/admin/add.php");
}else if($action == "edit"){
if(!isset($_GET['id']))
header ("Location: ../admin/index.php");
$id = (int)$_GET['id'];
if(!empty($_POST) && $id > 0){
articles_edit($link, $id, $_POST['title'], $_POST['anons'], $_POST['description'], $_POST['img'], $_POST['date'], $_POST['category']);
header ("Location: ../admin/index.php");
}
$article = articles_get($link, $id);
include("../views/admin/admin_panel.php");
}
else{
$articles = articles_all($link);
include("../views/admin/admin_panel.php");
}
?>
```
Ну и в файле саму функцию описал:
function articles_edit($link, $id, $title, $date, $img, $description, $anons, $category){
Что ему не нравится?




