Bonjour (That's all the French I know!!!)
I'm currenlty using the following code, to add data from a form into a database called records. Does anybody know how I can stop dulicate records by checking to see if the name entered is already in the database?
Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("WB", $con);
$sql="INSERT INTO Records (Name, Age, Sex)
VALUES
('$_POST[Name]','$_POST[Age]','$_POST[Sex]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo $_POST[Name] . "'s details were saved successfully!";
mysql_close($con)
?> Many Thanks,