Hi i need help with mysql_insert_id(); im trying to make a insert from a ID generated from the previous INSERT operation..
The new value that is generated from the colume ID in table childetopics, i wount it to insert the same value to colume called childetopicID in tabel mainposts..
Now i do not know how to do this but if som one can help med with this it woulde help me a lot ...
Here i the function.php
I hop some one can help me with this!!
<?php
include ("../Management/mysqlcondbfm.php");
function addmainpost () {
global $password,$email,$username,$post,$childetopicID;
$timestamp = time();
$new_password = addslashes($password); $new_email = addslashes($email);
$new_name = addslashes($username);
$new_post = addslashes(htmlspecialchars($post));
$insert = mysql_query("INSERT INTO mainposts VALUES ('NULL','$childetopicID','$new_name','$new_email','$new_password','$new_post','$timestamp')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b>There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
showfooter();
exit;
}
}
function addchildetopic () {
global $password,$email,$username,$maintopicID,$childetopicname;
$timestamp = time();
$new_password = addslashes($password); $new_email = addslashes($email);
$new_name = addslashes($username);
$new_post = addslashes(htmlspecialchars($childetopicname));
$insert = mysql_query("INSERT INTO childetopics VALUES ('NULL','$maintopicID','$new_post','$new_name','$new_email','$new_password','$timestamp')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b>There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
exit;
}
}
function addmaintopic () {
global $password,$email,$username,$maintopicname,$maintopicdescription;
$timestamp = time();
$new_password = addslashes($password); $new_email = addslashes($email);
$new_name = addslashes($username);
$new_post = addslashes(htmlspecialchars($maintopicdescription));
$insert = mysql_query("INSERT INTO maintopics VALUES ('NULL','$maintopicname','NULL','$new_name','$new_email','$new_password','$new_post','$timestamp')");
if (mysql_error() != "") {
showheader("MySQL Error ".mysql_error());
?>
<br><p><center><b>There was a MySQL Error -- <?php echo mysql_error() ?></b></center></p>
<?php
exit;
}
}
?>