Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
vipul73
Forum Commoner
Posts: 27 Joined: Mon May 12, 2003 5:32 am
Post
by vipul73 » Tue May 27, 2003 4:16 am
I am getting email address of a user from a feedback form and wish to generate a visitor number from that. I have tried inserting the email in a database and would like to get the last incremented value how do i get the same.
Code: Select all
<?php
$email = $_POST["email"];
$db = mysql_connect("localhost", "root");
mysql_select_db("visitor",$db);
$sql = "INSERT INTO invoice (email) VALUES ('$email')";
$result = mysql_query($sql);
mysql_insert_id();
echo "Thank you! Information entered.\n";
?>
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Tue May 27, 2003 4:40 am
You've already got this:
try setting it to a variable:
Mac
vipul73
Forum Commoner
Posts: 27 Joined: Mon May 12, 2003 5:32 am
Post
by vipul73 » Tue May 27, 2003 9:13 am
Thanks it is working perfectly now