Skip to content
Advertisement

Do Not Duplicate VALUE if already exist on MySQL

I’ve been trying to accomplish this, but as other issues I just can’t figured it out. I’ve been reading around for posibles solutions but non of them goes along with my code, or if they do I can’t figure out how or where to use them.

I have a DB where a user sends records. The database consist in few tables containing the Following “Name, Lastname, Phone“. If any of this values is duplicate, I would like my code to identify and Ignore the submission of the Form if ALL this VALUES already exist on the DB.

Here is my code:

JavaScript

Advertisement

Answer

The mysql_* function are all deprecated now, and should NEVER be used. change your code to do something like the following:

JavaScript

Here’s another question with a similar setting, that may also be useful to you:

https://stackoverflow.com/a/10414922/1507210

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement