Arbejder på de åbne spørgsmål :-)
Her kommer en længere smøre, tre filer!
Jeg har udeladt formfelterne, de lægger variablerne over i insert_DB.php
List tabelindhold - list_DB.php er den del der er langsom ved visning af nye poster
--------------------------------------------
Kald til databasen - zzz.php
------------------------------------
<?php
$con = mysql_connect("yyy","xx","zz");
mysql_select_db("zzz",$con) or die("Couldn't select database");
?>
List tabelindhold - list_DB.php
------------------------------------
<?php
header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
header('Pragma: no-cache'); // HTTP 1.0.
header('Expires: 0'); // Proxies.
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Vis liste over DB indhold</title>
</head>
<body>
<?php
//MySQL Database Connect
include_once 'zzz.php';
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET COLLATION_CONNECTION = 'utf8_unicode_ci'");
$result = mysql_query("SELECT * FROM POI");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>Fodnote</th>
<th>Titel</th>
<th>Rediger</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['footnote'] . "</td>";
echo "<td>" . $row['title'] . "</td>";
echo "<td><a href='POI_edit_DB.php?UID=". $row['id'] . "'>Rediger</a> - <a href='POI_delete_DB.php?UID=". $row['id'] . "'>Slet</a></td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
<a href="new_DB.php">Tilføj ny tekst</a> - <a href="list_DB.php">Opdater side</a>
</body>
</html>
Indsæt i tabel - insert_DB.php
------------------------------------
<?php
ob_start();
//MySQL Database Connect
include_once 'zzz.php';
//mysql_query("SET NAMES 'utf8'");
//mysql_query("SET CHARACTER SET utf8");
//mysql_query("SET COLLATION_CONNECTION = 'utf8_unicode_ci'");
$sql="INSERT INTO POI (footnote, title,layerID) VALUES ('$_POST[footnote]','$_POST[title]','$_POST[layerID]')";
$result = mysql_query($sql);
echo $sql;
// if successfully deleted
if($result){
echo "Updated Successfully";
}
else {
echo "ERROR";
}
mysql_close($con);
header("Location:
http://zzz/list_DB.php");
ob_end_flush();
?>