mysql 1062 error - is this concrete 5 or bluehost?3 users found helpful
This morning I went to log in to one of my concrete 5 sites and saw the following error message:
An unexpected error occured
mysql error: [1062: Duplicate entry '2067' for key 'PRIMARY'] in EXECUTE("insert into PageStatistics (cID, uID, date) values ('1', 0, NOW())")
Anyone able to shed some light??
I suggest to turn off site statistics in the dashboard. I normally turn it off anyway as it's not generally useful, especially if you use something else like Google Analytics.
I appreciate the option being there, but I'd prefer it to be off by default.
With statistics turned off, I doubt you'll see that error again.
and log in there?
Any other ideas?
I appreciate you taking time to help.
Any other ideas?
<?php $db = Loader::db(); $db->Excecute('DELETE FROM PageStatistics WHERE pstID = 2067'); echo 'Deleted record, now delete this file'; ?>
Then browse to
replace example.com with your domain
Then delete that file.
Edit. Forgot php tag
Thanks for this, I'll give it a try, but can you just confirm a little here for me, sorry, am a novice.
If I go to the /tools folder, it's currently empty. I've edited code in existing files without a problem, but haven't formed a new file...
what do I call the file I create?
Also, what did you mean by Forgot php tag?
Thank you for this and sorry again for being such an amateur!
Then upload that file to your host and put it in your root/tools folder.
After that you browse to 'www.yourdomain.com/index.php/tools/required/fixdb.php'
You will now only see a text in your browser telling you 'Deleted record, now delete this file'
Once that is done, you should delete the file 'fixdb.php' you uploaded before.
His 'Forgot php tag' was just him telling you he forgot a tag when he first posted his code, but it is now edited and fixed.
The Concrete 5 community saves the day once again.
Fatal error: Call to undefined method ADODB_mysql::Excecute() in /home3/tclauset/public_html/c5/tools/fixdb.php on line 3
I have not gone into the msql database to try to delete the offending table yet and was wondering if either I messed up the fixdb.php file or if perhaps something is missing that caused the fatal error message.
Here is the modified fixdb.php file that I created from your instructions:
<?php $db = Loader::db(); $db->Excecute('DELETE FROM PageStatistics WHERE pstID = 32059'); echo 'Deleted record, now delete this file'; ?>
Can you suggest a next step for me? Many thanks for your help. It's disconcerting to have your Concrete5 site suddenly dead in the water after days of tweaking its content.
Since I've decided to use Google Analytics on the site, I turned OFF the site statistics option for Concrete 5.
Thanks for the discussion above. It was a great help!
Some more detailed instructions for beginners like me:
1. Log in to phpMyAdmin
2. Select the PageStatistics table on the left
3. Go to the "Operations" page
4. At the bottom under "Table Maintenance", choose "Check Table".
5. Go back to the same area and "Repair Table".