This topic is locked
[SOLVED]

 Duplicate Entry To Db Use Javascript Error

2/14/2013 10:48:42 AM
PHPRunner General questions
D
djm601 author

Hi,
I wonder if you can help. I have a field that is set as unique. When a user enters data that is already in the DB he receives the following message
e.g.
<<< Record was NOT added >>>
Duplicate entry 'SH1234567891478521' for key 2

--
Can I change this error to be a JavaScript alert?
something like this..
echo "<script>alert('Duplicate entry 'SH1234567891478521' for key 2')</script>"
any help much appreciated.

Dave

Sergey Kornilov admin 2/14/2013

No, this cannot be changed to be a Javascript alert.

D
danaci 2/16/2013

$.ajax({

url: ..

data: ..

type: ..

..
success:function(data){

if (data){

alert('rexord duplicate');

}

}
})