<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("tutorial", $con);
if($_REQUEST["submit"]=="submit")
{
$sql="INSERT INTO details ( Name, Surname, father, Gender, Martialstatus, Qualification, specification, Aggregate, Address, City, State,Pincode, PassportId, Mobile, EmailId)
VALUES
('$_POST[Name]','$_POST[Surname]','$_POST[father]','$_POST[Gender]','$_POST[Martialstatus]','$_POST[Qualification]','$_POST[specification]','$_POST[Aggregate]','$_POST[Address]''$_POST[City]','$_POST[State]','$_POST[Pincode]','$_POST[PassportId]','$_POST[Mobile]','$_POST[EmailId]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
}
mysql_close($con);
?>
in this table Id is primary key and set to auto increment.
a php form was created to insert the data.. and on submit from that form a unique code must be generated and it should go into Id column in the table...
i think a function is needed ,can anyone help me in writing that function...please