Warning: duplicate entry | Ad module | Advertisements | Drupal 6

The Problem:

[6.x-2.2](http://drupal.org/node/646830) I was having the following error every time I resaved an ad or made changes to an ad:

user warning: Duplicate entry '32-0' for key 'PRIMARY' query: INSERT INTO ad_priority (aid, priority) VALUES(32, 0) in /data/www/flash_guru.localhost/sites/all/modules/ad/channel/ad_channel.module on line 710.
And
user warning: Duplicate entry '32-0' for key 'PRIMARY' query: INSERT INTO ad_channel_remnant (aid, remnant) VALUES(32, 0) in /data/www/flash_guru.localhost/sites/all/modules/ad/channel/ad_channel.module on line 715.
The Solution:

In modules/ad/channel/ad_channel.module I found that in the function _ad_channel_save_node they were not using a very thurough way of checking if the records already existed. I could have come up with something a little more efficient but I just threw together a redundant solution.



comments powered by Disqus