PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi All,
I am getting duplicate record inserted in the mysql database using PHP.
could [s]u[/s] [color=green]you[/color] please help,
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Start by enclosing the entire query in double quotes (as you should when declaring any string). There is nothing in this code that would cause your query to execute twice... it's likely that it's something before or after. Post it.
Obviously the PHP code you've posted is incorrect, as aaronhall alluded to.
I did notice something odd with your query, you have as first on your list a column named `uid` and are inserting a string '1' into that column. What type of column is `uid`? I would assume based on my experience that it's supposed to be an auto_increment INT type column, but if you haven't defined it that way you could most certainly get duplicate records. You should definitely not be attempting to insert a value to that column, especially not a numeric value in quotes.