I have a database table registration(id,firstname,comment,reg_id)
iam fill the form and values are insert into database (firstname comment) ,i want to insert reg_id automatically.
id firstname comment reg_id
1 Alexy tfhgfnjh R20123
2 Thomas fdghfgh R20124
3 chako cgjkjhl R20125
4 Thomasxc cgjkjhl R20126
5 Thomaseg fdghgh R20127
6 Thomasm fsgdfgbd R20128
but its not work ,reg_id value was not increment properly.
Code From Comment.
if($checksql>$reg_id){
$checksql1=mysql_query("select reg_id from registration where id='$rid'");
$r=mysql_fetch_array($cheksql1); $rgid=$r['reg_id'];
$reg_id1= $rgid+1;
$regid=mysql_query("update registration set reg_id='$reg_id1' where id='$rid'");
}
how to solve my problem?