$fname=$_POST['fname'];
$lname = $_POST['lname'];
$Phone = $_POST['Phone'];
$date = date("Y/m/d");
mysql_query ( "INSERT INTO example (fname,lname,Phone,date) VALUES ('$fname' ,'$lname', '$Phone', '$date')")
or die(mysql_error());
when i write a duplicate entry in my codes these Error will display: my PRIMARY key is Phone.
Duplicate entry '' for key 'PRIMARY'
but i want to check and display by JavaScript to Prevent this Error before adding data. how is it possible? please help completely and wire source. thanks