Edit query returning duplicate rows

Help
2010-03-01
2013-05-28
  • Phil Stevens

    Phil Stevens - 2010-03-01

    I've had a strange problem crop up in an installation that has been live for a couple of months. Users have begun adding entries, and the first 20 or so were fine. With the last few, when either the user who owns the entry or the admin clicks the edit link in detail view, an error message is displayed with the query text and error number 0. If I run the query in mySQL at the console, I get 2 rows returned, even though there is only one row in the refs table. Examination of the user_data table shows 2 rows per record_id for the admin user…is this indicative of the problem?

     
  • Matthias Steffens

    Hi Phil,

    Examination of the user_data table shows 2 rows per record_id for the admin user…is this indicative of the problem?

    Yes, that's the problem, though I'm not sure how this could have happened in the first place.

    To cure the problem, inspect the two 'user_data' table entries that point to the same 'record_id' (using the MySQL command line interpreter or a web-based tool such as phpMyAdmin), and identify the entry which has the most complete/up-to-date data. Then delete the other one of the two 'user_data' entries, e.g. via it's 'data_id':

    DELETE FROM user_data WHERE data_id = xxxx;

    HTH, Matthias

     
  • Phil Stevens

    Phil Stevens - 2010-03-01

    Thanks Matthias. I did a similar delete query the first time the problem was reported. Now we need to see what is inserting the extra row…suggestions? I guess I'll turn on debug level logging in php.ini for starters.

    cheers,

    Phil

     

Log in to post a comment.