Fejl kode i php hmm
Jeg får denne her fejl kodeTilføj Besked
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in d:\apachewebroot\my-city.dk\misko\nyheder\nyheder.php on line 29
1
Her er min KODE:
<head>
<link rel="stylesheet" href="style.css" style="tekst/css">
<title>Nyheder</title>
</head>
<?
//Side skifte
include "mysql.php";
$query = ("SELECT id FROM nyheder2;");
$result = mysql_query($query) or die("MySQL Error: " . mysql_error());
$num_rows = mysql_num_rows($result);
$max = 4;
$pages = ceil($num_rows / $max);
if ($_GET["page"]) {
$page = $_GET["page"];
}
else {
$page = 1;
}
//Henter Dataen fra databasen
$news = mysql_query("select id, name, dato, icq, msn, email, besked, icon FROM nyheder2 ORDER BY dato desc LIMIT " . ($page - 1) * $max . ", " . $max . ";");
//Her poster jeg så minne skraves poster ud fra databasen
echo "<center><a href='skrivnyhed.php'>Tilføj Besked</a><br /><br />";
while($row = mysql_fetch_array($news))
{
$id = $row[id];
$name = $row[name];
$dato = $row[dato];;
$besked = $row[besked];
$icon = $row[icon];
?>
<table width='95%'>
<tr>
<td width='50' valign='top'><img src='icon/<?=htmlspecialchars($icon);?>'></td>
<td valign='top'>
<b><?=htmlspecialchars($name);?></b><br>
<?=htmlspecialchars($besked);?></td>
</tr>
</table>
<br>
<?
}
//Side skifet ligger det her sådan der er tal på side skiftet
for ($i = 1; $i <= $pages; $i++) {
print("<a href=\"" . $_SERVER["PHP_SELF"] . "?page=" . $i . "\">" . $i . "</a> \n");
}
//Gæstebogs indlæg ender her
?>