Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    89
    Rep Power
    2
    don't understand. in the table from where i get the data into the members field i dont have any duplicate. the duplicate appears when i edit the same article multiple times. the id will go into the members field over and over
    Last edited by pwpx2; January 12th, 2018 at 07:06 AM.
  2. #17
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,757
    Rep Power
    4288
    could you show a before/after of the row which includes the dupes
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #18
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2016
    Posts
    106
    Rep Power
    65
    the duplicate appears when i edit the same article multiple times. the id will go into the members field over and over
    If you are EDITING existing data, you are probably retrieving the existing data first and putting it into the form field value(s)? If so, wouldn't that mean that the value in the form field in question IS the whole starting value and using CONCAT() to append that whole value to what is already in the database table column would result in repeating the data? You should just update the column in question with the submit form data, not CONCAT() it.

    If you want the UPDATE process to only append a new value to the column, you would NOT populate the form field with the existing value.

    Or you could just do what has been suggested and normalize the data, by storing the article_special id's in a separate child table, one row per id, related back to the member table through the user's id. By defining the user's id and article_special id columns in the separate child table as a composite unique index, the table will enforce uniqueness in the data pairs.
  6. #19
  7. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,757
    Rep Power
    4288
    Originally Posted by DSmabismad
    Or you could just do what has been suggested and normalize the data, by storing the article_special id's in a separate child table, one row per id, related back to the member table through the user's id. By defining the user's id and article_special id columns in the separate child table as a composite unique index, the table will enforce uniqueness in the data pairs.
    OP's response: "Perhaps.. but this is what i've got so far.. If it does the job its ok "
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  8. #20
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    89
    Rep Power
    2
    everything works as intended guys.
    thank you
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo