Hi Guys,
I was wanting to know how to use the LAST_INSERTED_ID() on the following section of code.
<?php
include(\"include/dbconnect.php\");
if($submit){
$sql = \"insert into categories(CatID, CatParent, CatName, email, url, pref, active)
values(NULL,\'$CatParent\',\'$CatName\',\'$email\',\'$url\',\'$pref\',\'$active\')\";
$result = mysql_query($sql);
$from = \"From: Only Melbourne - Your Guide to Melbourne\";
mail($email, \'Only Melbourne\', \"Congratulations!\\nYour web site $url has been recommended for a free link in Only Melbourne!\\nAll you have to do is validate the details of your web site.\\n\\nClick below (now) to validate your details:\\nhttp://www.onlymelbourne.com.au/validate.php?id=$new\\n\\nOnly Melbourne is the internet home of Melbourne with over 90K links and millions of visitors every month!\\nMelbournians, Interstate and International visitors alike have voted Only Melbourne the top site in Australia!\\nWe look forward to you being part of Only Melbourne!\\nRegards\\nOnly Melbourne Team\\nhttp://www.onlymelbourne.com.au\\nwebmaster@onlymelbourne.com.au\",
//\"To: The Receiver <recipient@some.net>\\n\" .
\"From: Only Melbourne - Your Guide to Melbourne <webmaster@ripefruit.com.au >\\n\");
if($result){
echo \"<br>Information uploaded successfully.\n\";
echo \"<br><br><a href=\\"javascript:void(0);\\" onclick=\\"history.back(); return(false);\\" >BACK</a>\";
}
else{
echo \"<br><font color=\\"red\\"><b>ERROR:</b> Your data could not be updated</font>\n\";
}
}
else {
?>
What i want to be able to do is pass the LAST_INSERTED_ID from the fisrt query and place that value in the message section of the mail script were it says
Click below (now) to validate your details:\nhttp://www.onlymelbourne.com.au/validate.php?id=$new
The value $new will be the LAST_INSERTED_ID
Any ideas?
Cheers,
maccam