I'm having the same problem as #769518: Error: duplicate entry 414 (INSERT INTO menu_per_role ...), except the 1.6 update you released is not fixing it for me on one website. I maintain separate live and development sites. I do not have this problem on my live site, but on one of the development sites I am seeing the error pop up. The only difference is that this particular development site is running PHP 5.3.2, while the live and other development sites are running 5.2.9.

I hadn't seen this problem until I started testing our PHP 5.3 compatibility.

Comments

Iris,

You could just re-activate #769518: Error: duplicate entry 414 (INSERT INTO menu_per_role ...) instead of creating a new issue... 8-)

I just cannot see how that duplicate could happen with 1.6... Are you sure you have 1.6 on that website?

Thank you.
Alexis

Status:Active» Fixed

I'm marking this as fixed as I did not get any answer and I would think that this is really fixed.

If you still have a problem, let me know and please copy/paste the error so we can see the line # where the problems occurs.

Thank you.
Alexis

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Version:6.x-1.6» 6.x-1.7
Status:Closed (fixed)» Active

Hi,

I don't know if it's the same problem, but in my case:
version 6.x-1.7
menu_per_role.module on line 140.

// save in our table
      //db_lock_table('menu_per_role');
      db_query("UPDATE {menu_per_role} SET rids = '%s', hrids = '%s' WHERE mlid = %d", $rids_str, $hrids_str, $mlid);
      if (db_affected_rows() == 0) {
        // if nothing was affected, the row did not exist yet
        // (although with MySQL this may fail because db_affected_rows() may only return
        // rows that have been changed instead of the # of rows that match the WHERE clause.)
        db_query("INSERT INTO {menu_per_role} (mlid, rids, hrids) VALUES (%d, '%s', '%s')", $mlid, $rids_str, $hrids_str); // <-- Line 140
      }

I think a check to database is needed to know if the value is there, before make any insert or update, what I mean is that db_affected_rows() is not enough...is that correct?

Thanks

Status:Active» Fixed

This code has been fixed and checked in for some time now. If you still have the problem, feel free to reopen the issue.

Thank you.
Alexis

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.