I have a sample database of students in a class with their id(UNIQUE), name,gender, birhdate, marks etc.
What i intend to do is :
- if the student has not entered his data, it should insert the data.
- if the student is using for the second time, the time should update. i used the code below but its not working .
Thanks!!
// open connection
$con = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
mysql_query("INSERT INTO UserData VALUES ('$id','$name','$gender','$email','$birthday','Marks','NOW()')");
mysql_close($con);