PHP - SQL kan ikke få noget ud af databasen
SIDE 1 KALDET "TAGWALL.PHP"<html>
<H2 align="center">Tagwall</h2>
<TABLE>
<TR>
<TD>
<form action="tagwall2.php" method="post">
Navn: <input type="text" name="navn">
</TD>
</TR>
<TR>
<TD>
<textarea name="text" rows="7" cols="22"></textarea>
</TD>
<TR>
<TD>
<input type="submit" value="Skriv">
</form>
</td>
</TR>
</TR>
</TABLE>
</html>
<?
include('admin/connect.php');
$link = mysql_connect($connect, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error()) ;
$resultat = mysql_query("select * from tilmelding");
#her skulle den så gerne skrive noget ud !
while ($raekke = mysql_fetch_array($resultat)) {
echo "Navn: ".$raekke['navn']."<br />".
.$raekke['text']
}
mysql_close($link);
?>
SIDE 2 KALDET "TAGWALL2.PHP"
<?php
header('location: index2.php?side=tagwall');
include('admin/connect.php');
$link = mysql_connect($connect, $user, $password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error()) ;
$navn = $HTTP_POST_VARS['navn'];
$text = $HTTP_POST_VARS['text'];
$tid = date("F j, Y, g:i a");
$ip = $_SERVER[REMOTE_ADDR];
$tabel = "tagwall" ;
$query = "SELECT * FROM tilmelding";
$insertSQL = "insert into $tabel set navn='$navn', text='$text', ip='$ip', tid='$tid'" ;
mysql_query($insertSQL) or die(mysql_error());
mysql_close($link) or die(mysql_error());
?>