Hi Guys,
i'm having trouble passing the auto_incremented field named post_id to the META redirection at the top of the script.
Can anyone see an error? I don't get a value at all. Is there something wrong with my $post_id = mysql_insert_id(); line of code?
Any ideas?
<META HTTP-EQUIV="refresh" CONTENT="3; URL=typh_forum1.php?id=<?=$post_id?>">
<?
{
echo "<div align=\"center\"><font face=Verdana, Arial size=4><b>Typhoon Administration Area</b></font>";
echo "<hr>";
echo "<font face=Verdana, Arial size=2><b>Results:</b></font><br>";
echo "<hr><br>";
if (!$name)
{
echo "<font face=Verdana, Arial color=red size=2><b>WARNING!</b></font><font face=Verdana, Arial size=2> You have not entered data for the required fields:</font><br>";
echo "<font face=Verdana, Arial size=2>Please go back and try again.</font>";
exit;
}
@ $db = mysql_pconnect('localhost', '', '');
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("typhoon");
$query = "insert into posts(name, email, topic_name, post, time_stamp, last_post, autorespond)
values('$name','$email','$topic_name','$post','$time_stamp','$last_post','$autorespond')";
$post_id = mysql_insert_id();
$result=mysql_query($query);
if($result)
echo "<font face=Verdana, Arial size=2>Your post was successfully inserted into the database.</font><br>";
echo "<font face=Verdana, Arial size=2>If you do not get automatically directed back to the forum index click on the \"Back to main page\" link below</font><br>";
}
echo "<br><a href=\"typh_forum.php\">Back to main page</a></div>";
?>