id varchar(30) not null primary key
username varchar(15)
password varchar(15)
when i insert values in table using $_POST[] it gives error
Error:Duplicate entry 'john' for key 'PRIMARY' whereas there is no entry in my table as john.Code is:
Expand|Select|Wrap|Line Numbers
- <?php
- $con = mysql_connect("localhost","root","");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("seed_bank", $con);
- $sql = "insert into members(id,username,password)
- values('$_POST[emailid]','$_POST[firstname]','$_POST[password]')";
- print $sql;
- $result=mysql_query($sql);
- $count=mysql_num_rows($result);
- if($count==1)
- {
- echo "Registration SUCCCESSFUL";
- }
- if(!mysql_query($sql,$con))
- {
- die('Error:'.mysql_error());
- }
- else {echo"Registration succcessful";}
- mysql_close($con);
- ?>