I know this question has been answered many times but just cant seem to make it work within my existing code. Forgive me for being a dunce. My question: I just need to get the indexed and auto-incremented client_id value upon creating a new record, so I can send it to the new user via email along with their password so they can log into their account. Here is my code and thanks for any help. I also understand I should convert from MySQL to mysqli:
$conn = mysql_connect($servername, $username, $password, $dbname);
if (!$conn) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($dbname,$conn);
$sql="INSERT INTO ricks_inserts (companyname, contact, email)
VALUES ('$_POST[companyname]','$_POST[contact],'$_POST[email]')";
$id = mysql_insert_id(); "My actual variable in my table is called client_id"
if (!mysql_query($sql,$conn))
{
die('Error: ' . mysql_error());
}echo "<br />";
$message= <<<EOD
Client Id:$_POST[client_id]
Email: $_POST[email]
Company: $_POST[companyname]
Contact: $_POST[contact]
EOD;