php - How to stop duplicate entries into database -


itemprop = "text">

Hi there I am trying to insert an array of information in the fields in a database through the selection of the checkbox, OK I am able to insert a duplicate when inserting which is not good I am using the following to insert the item

  $ list = $ _POST ['sub']; // Quote $ queryQuery = 'tbl_list INSERT (`userId`,` subId')) for each lock for each value to run user information foreach ($ value as $ value) {// $$} value in database (value) \ ''. $ Id. '\', \ '. $ Value.' \ ')'; // Query $ Objects- & gt; Run query ($ listQuery); }  ,  sub id < / Code>):  
  Add ALTER TABLE tbl_list unique (`userId`,` sub id`)   

Then, you should Use INSERT IGNORE or to change again to avoid it.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -