You were missing a couple ending curly braces:
PHP Code:if (isset ($_POST['submit']))
{
if ($dbc = @mysql_connect ('localhost', 'root', ''))
{
if (!@mysql_select_db ('forum'))
{
die ('<p>Could not select the database because: <b>' . mysql_error() . '</b></p>');
}
$query = "INNSERT INTO forum_entries (blog_id, title, entry, date_entered)
VALUES (0, '{$_POST['title']}', '{$_POST['entry']}', NOW())";
if (@mysql_query ($query))
{
echo '<p>The blog entry has been added.</p>';
} else
{
echo "<p>Could not add the entry because: <b>" . mysql_error() . "</b>. The query was $query</p>";
}
}
}
mysql_close();
if ($dbc = @mysql_connect ('localhost', 'root', ''))
{
if (!@mysql_select_db ('forum'))
{
die ('<p>Could not select the database because: <b>' . mysql_error() . '</b></p>');
}
$query = 'SELECT * FROM forum_entries ORDER BY date_entered ASC';
if ($r = mysql_query ($query))
{
while ($row = mysql_fetch_array ($r))
{
echo "<p><h3>{$row['title']}</h3>{$row['entry']}<br />
<a href=\"forum.php?id={row['forum_id']}\">Edit</a>
<a href=\"delete_entry.php?id={$row['blog_id']}\">Delete</a>
</p><hr />\n";
}
}
}
else
{
die ('<p>Could not retrieve the data because: <b>' . mysql_error() ."'</b>The query was $query</p>");
}




Reply With Quote