Code: Select all
<?include "header.phtml"?>
<?php
// Create Connection
$connection = mysql_connect("localhost","USERNAME","PASSWORD") or die ("Couldn't Connect to Server");
// Select Database
$db = mysql_select_db("hb", $connection) or die ("Couldn't Connect to DB");
// Create SQL Statement
$sql = "SELECT name, date, title, story, id FROM Stories order by date desc" or die ("Couldn't SQL");
// Execute Search and Result
$sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query");
// Start Results Formatting
// echo "<TABLE bgcolor=black BORDER = 0 WIDTH=100%>";
// Format Results
while ($row = mysql_fetch_array($sql_result) ) {
$name = $rowїname];
$title = $rowїtitle];
$story = $rowїstory];
$date = date("D F, Y",$rowїdate]);
$id = $rowїid];
echo <<<EOT
<b>User:</b> $name
<br><b>Date:</b> $date<br>
<b>Title:</b> $title
<br>
<b>Journal Entry from:</b> $name<br><br>$story<br><a href=viewstorydelete.phtml?B=C&id=$id>Delete</a><hr width="100%" size="1" color="#3B6A8A"><br>
</font>
</center>
EOT;
}
// Close Formatting
If($B == "C") {
$sql2 = mysql_query( "DELETE FROM Stories WHERE id = '$id'");
}
?>
<?include "footer.phtml"?>