PHP/MySQL Gæstebog
Hej Eksperter!Jeg får denne fejlmeddelse når jeg prøver scriptet af:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /var/www/sparklinjune.com/public_html/guestbook.php on line 34
Mit PHP ser således ud:
<html>
<head><title>Guestbook</title></head>
<body>
<?php
$db = mysql_connect("db.sparklinjune.com","sparklinjune.com","blyant");
mysql_select_db("guestbook",$db);
if ($skriv){
$besked = str_replace("\n","<br>",$besked);
$dato = date("d.m.Y")." ".date("H:i");
mysql_query("INSERT INTO guestbook (navn, overskrift, besked, dato, email) VALUES('$navn', '$overskrift', '$besked', '$dato', '$email')");
}
?>
<table width="230px">
<h1>Guestbook</h1>
</table>
<form method="post" action="<?php echo $PHP_SELF;?>">
<input type="hidden" name="skriv" value="1">
<table width="230px">
<tr><td><p>Kaldenavn:</td><td><p>Email:</td>
<tr><td><input type="text" name="navn" size="15" maxlength="13"><br></td>
<td><input type="text" name="email" size="23"></td></tr>
<tr><td colspan="2"><p>Overskrift:<br><input type="text" name="overskrift" size="42" maxlength="25"></td></tr>
<tr><td colspan="2"><p>Besked:<br><textarea name="besked" cols="41" rows="5"></textarea></td></tr>
<tr><td align="right"><input type="submit" value="Send"></td></tr>
</table>
</form>
<?php
$foresp = mysql_query("SELECT navn, overskrift, besked, dato, email FROM guestbook ORDER BY nr DESC");
while($data = mysql_fetch_row($foresp)){
echo $data[0];
echo $data[4];
echo $data[3];
echo $data[2];
}
?>
</body>
</html>
På forhånd tak :)