Dobry den, tak mam kod v php pre pridavanie noviniek ale stazuje si ERROR na riadok while
($komentar = MySQL_Fetch_Array($vysledok))
prosiiiim pomozte mi
<?php
include ("connect.php");
$novinka = (int) $_GET["novinka"];
$url = "novinka.php?novinka=" .$novinka;
if($_POST["ok"]){
$autor = $_POST["autor"];
$text = $_POST["text"];
if(("" !=$autor) && ("" !=$text)){
MySQL_Query("INSERT INTO komentare (id_novinka, autor, text, datum) VALUES (" . $novinka . ", '" . addslashes($autor) . "', '" . addslashes($text) . "', NOW())");
echo htmlspecialchars("INSERT INTO komentare (id_novinka, autor, text, datum) VALUES (" . $novinka . ", '" . addslashes($autor) . "', '" . addslashes($text) . "', NOW())");
$autor = "";
$text = "";
}
}
else{
$autor="";
$text="";
}
$vysledok = MySQL_Query("SELECT * FROM novinky WHERE id = ".$novinka);
$vypis = MySQL_Fetch_Array($vysledok);
$vysledok = MySQL_Query(" SELECT * FROM komentare WHERE id_novinky = ".$novinka." ORDER BY datum DESC");
$komentare =array();
while($komentar = MySQL_Fetch_Array($vysledok)) {
$komentare[] = $komentar;}
require("ninc1.php");
echo "<b>" . htmlspecialchars($vypis['nadpis']) . "</b><br><br>";
echo htmlspecialchars($vypis['clanok']);
echo "<br><br><br>";?>
<form action="<?php echo htmlspecialchars($url); ?>" method="POST">
Nick: <input type="text" name="autor" value="<?php echo htmlspecialchars($autor); ?>"><br><br>
Text:
<textarea name="text" rows="10" cols="30"><?php echo htmlspecialchars($text); ?></textarea><br><br><br>
<input type="submit" name="ok" value="Send"><br><br>
</form>
<?php
foreach($komentare as $komentar){
echo "<b>" . htmlspecialchars($komentar["autor"]) . "</b> " . "<small>" . $komentar["ip"] . "</small><br>";
echo htmlspecialchars($komentar["text"]);
echo "<br><br><br>";}
?>
<?php
require ("ninc2.php");
?>