Witam,
Poniższy skrypt ma za zadanie wyświetlać całość artykułów, których skrócona wersja znajduje się na stronie głównej.
<html>
<head>
<title>FashionNews</title>
<link href="style.css" type="text/css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,700&subset=latin,latin-ext' rel='stylesheet'
type='text/css'>
</head>
<body>
<div id="container">
<h1>FashionNews</h1>
<?php
$id = (int)$_GET['id'];
require_once('dbconect.php');
require_once('funkcje.php');
$mysql = new mysqli($host, $db_user, $db_password, $db_name);
if ($mysql->connect_errno) {
echo "Connect Errno" . mysqli_connect_errno();
}
$q = 'SELECT tresc_dluga FROM news WHERE id_news = '.$id;
$results = query($mysql, $q);
if (!$results->num_rows) {
echo 'Nie znaleziono newsa';
} else {
$results = $results->fetch_assoc();
}
$colors = ['#0D7E71', '#b1660e', '#B71757', '#2d95bb'];
$i=0;
foreach ($results as $result) {
?>
<div class="news" style="background: <?php echo $colors[$i%count($colors)] ?>">
<h2><?php echo $result['nazwa'] ?></h2>
<div class="author"><?php echo $result['autor'] ?></div>
<div class="content">
<?php echo $result['tresc_dluga'] ?>
<div class="show_more"><a href="long_article.php" style="background: <?php echo $colors_buttom[$i%count($colors_buttom)] ?>"> Show more</a></div>
</div>
</div>
<?php
$i++;
} ?>
</div>
</body>
</html>
Wyświetla mi błąd
( ! ) Notice: Undefined index: id in C:\xampp\htdocs\news\long_article.php on line 12
W lini 12 wydaje się być wszystko OK. Prosze o pomoc