I am using mySQL and Fabrik and Joomla for my web app and out of the blue it started giving errors:
Duplicate entry '' for key 1 SQL=INSERT INTO `main_table` (`field1`,`field2`,`field3`) VALUES ( 'Value1','Value2','','Value3')
This meant that no data was being successfully entered into that database table :(
After Googling a bit (no, a lot) I stumbled into this blog which helped me a lot (thanks Vinu Thomas):
http://blogs.vinuthomas.com/2008/06/18/mysql-error-1062-duplicate-entry-0-for-key-1
“
The important sentences: “Mysql throws this error because the field type of the auto increment field is not large enough to hold the next value, so it tries to wraps the count back to ’0′ where the is already a record with that value.
We changed the field from int to unsigned bigint which fixed the problem for us. So if you face the same problem, check if your auto-increment field has maxed the datatype for that field.
”
That’s exactly what I did and saw that my table definition was this – where field1 was the PK and of type varchar(255):
table_name CREATE TABLE `table_name` (
`field1` varchar(255) NOT NULL auto_increment,
`field2` varchar(15) default NULL,
`field3` varchar(255) default NULL,
) ENGINE=MyISAM AUTO_INCREMENT=843 DEFAULT CHARSET=latin1
I altered the table to this and the problem was solved!:
table_name CREATE TABLE `table_name` (
`field1` bigint(255) unsigned NOT NULL auto_increment,
`field2` varchar(15) default NULL,
`field3` varchar(255) default NULL,
) ENGINE=MyISAM AUTO_INCREMENT=843 DEFAULT CHARSET=latin1
Using this sql statement:
alter table `dbname`.`table_name` change `field1` `field1` bigint(255) UNSIGNED NOT NULL AUTO_INCREMENT
Friday, 30 September 2011
Error Code : 1062 Duplicate entry '' for key 1 auto_increment [SOLVED]
Sunday, 25 September 2011
Tree fell across Doordrift Road, Constantia in Cape Town
A colleague’s friend told of a story that she was driving on Doordrift Road last night (Saturday) and about 21h00 (after sunset – so it was already quite dark) when they heard a load creaking sound then suddenly this HUGE tree fell about 20m in front of their car (which was travelling at about 60km/h).
They got the fright of their lives and luckily they managed to stop in time – they also were sooo, lucky that the tree didn’t fall on top of their car!
This is what they saw last night:
They got out and tried to manage the traffic as best as they could – including cyclists who couldn’t see the tree across the road.
They notified ADT (security company) and the local authorities who managed to close the road and start working on clearing the tree.
This morning we decided to go and see if the tree was cleared. I was very surprised to see that the road was still closed and the chain saw was still hard at work to removed the HUGE tree.
Here are some photos of what we saw this morning:
This is the damage to the townhouses across the road:
So, now, who pays for the clearing of the tree and for the damage to the wall, wrought iron fence and electric fence?
Seems like the construction workers “trimmed” the roots of the tree. These construction workers were building a pathway along the road and dug quite deeply to lay the foundations for this cobble pathway.
Oh well – at least nobody got killed and we will need to see who wins the fight for these material items. Those people in the car were really lucky it didn’t land on them!
They got the fright of their lives and luckily they managed to stop in time – they also were sooo, lucky that the tree didn’t fall on top of their car!
This is what they saw last night:
They got out and tried to manage the traffic as best as they could – including cyclists who couldn’t see the tree across the road.
They notified ADT (security company) and the local authorities who managed to close the road and start working on clearing the tree.
This morning we decided to go and see if the tree was cleared. I was very surprised to see that the road was still closed and the chain saw was still hard at work to removed the HUGE tree.
Here are some photos of what we saw this morning:
This is the damage to the townhouses across the road:
So, now, who pays for the clearing of the tree and for the damage to the wall, wrought iron fence and electric fence?
Seems like the construction workers “trimmed” the roots of the tree. These construction workers were building a pathway along the road and dug quite deeply to lay the foundations for this cobble pathway.
Oh well – at least nobody got killed and we will need to see who wins the fight for these material items. Those people in the car were really lucky it didn’t land on them!
Subscribe to:
Posts (Atom)
HTT topics cloud
tips
(79)
Money saving tips
(76)
time saving tip
(62)
free
(58)
free programs
(50)
free apps
(48)
free software
(48)
free services
(28)
Calculator
(19)
Skype
(18)
Vodacom
(17)
discount
(15)
Cape Town
(14)
cellphone
(14)
SMS
(13)
SkypeOut
(13)
VOIP
(13)
Vodacom PrePaid
(12)
ADSL
(11)
save electricity
(11)
BlackBerry
(10)
International calls
(10)
Vodago
(10)
mobile Internet
(10)
reduce power usage
(10)
saving electricity
(10)
stop crime
(10)
PrePaid ADSL
(9)
CellC
(8)
Firearm licence
(8)
GPS
(8)
Telkom
(8)
airtime
(8)
neighborhood watch
(8)
tagga
(8)
Electricity Usage Calculator
(7)
pre-paid electricity
(7)
send free SMS
(7)
stolen goods
(7)
Electricity Tariff Calculator
(6)
Firefox
(6)
Mugabe
(6)
SIP
(6)
compare prices
(6)
gmail
(6)
solar heating
(6)
time switch
(6)
DIY
(5)
MS office
(5)
Zimbabwe
(5)
anti-theft
(5)
best cell phone apps
(5)
cash back
(5)
flag as stolen
(5)
phishing
(5)
thermostat setting
(5)
3G settings
(4)
Discovery credit card
(4)
TopTV
(4)
Yebo4Less
(4)
load shedding
(4)
second hand goods bill
(4)
Discovery Vitality
(3)
GPRS settings
(3)
Gun license renewal
(3)
Joomla
(3)
MS Outlook
(3)
Online backup
(3)
ZenCart
(3)
backup
(3)
credit card
(3)
free games
(3)
scam
(3)
567CapeTalk
(2)
Asperger's
(2)
Celine Dion
(2)
Lotto results
(2)
WWE wrestling
(2)
eTV wrestling
(2)
emoticons
(2)
secret emoticons
(2)
Discovery Health
(1)
Discovery Life
(1)