Hi All i'm having touble getting the thread_id to insert into my database
I have two tables as you can see the thread_id is generated when added to forum_thread, once generated it needs to then insert forum_posts.... what would i need to do to the code below to make this happen!
<?php
session_start();
if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: ../login.php");
}
?>
<?php
mysql_connect (localhost, user, pass);
mysql_select_db (table);
?>
<?php
if ($title == "")
{
require("../formerror.php");
}
if ($body == "")
{
require("../formerror.php");
}
$result = mysql_query ("INSERT INTO forum_thread (`thread_id`,`main_id`,`title`,`username`) Values ('','$main_id','$title','" . $_SESSION["valid_user"] . "')") or die("INSERT error: ".mysql_error());
$result3 = mysql_query ("INSERT INTO forum_posts (`id`,`thread_id`,`main_id`,`topic`,`body`,`username`) Values ('','$thread_id','$main_id','$topic','$body','" . $_SESSION["valid_user"] . "')") or die("INSERT error: ".mysql_error());
?>