Okay her kommer det!!
Index.php
<html>
<head>
</head>
<body>
<?php
include "dbc.php";
if (!isset($_POST["add"])) {
?>
<form action="<? $PHP_SELF ?>" method="post">
<h2>Overskrift</h2>
<input type="text" name="Overskrift" size="40" maxlength="80">
<br />
<br />
<h2>Text</h2>
<input type="text" name="text" style="height: 500px; width:800px;"><br /><br />
<input type="submit" name="add" value="Opret">
</form>
<?php
}
else {
$ov = $_POST["Overskrift"];
$te = $_POST["text"];
mysql_query("INSERT INTO nyhed (overskrift, text) VALUES ('$ov', '$te')") OR DIE(mysql_error());
}
?>
</body>
</html>
Lav.php
<?php
include "dbc.php";
mysql_query("CREATE TABLE nyhed(
id INT AUTO_INCREMENT,
Overskrift VARCHAR(100),
text VARCHAR(700),
PRIMARY KEY(id)
)") OR DIE(mysql_error());
?>
Den skal køres en gang, ikk?
Læs.php
<?php
$sk = mysql_query("SELECT Overskrift,text FROM nyhed") or die(mysql_error());
echo $sk;
?>
dbc.php
<?php
mysql_connect("server", "brugernavn", "password") or die(mysql_error());
mysql_select_db("databasenavn") or die(mysql_error());
?>
Virker det ?