Advertisement
500 - An error has occurred!
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Oct 02, 2010 9:05 am
500 - An error has occurred!
debug echo:
500 - An error has occurred!
JDatabaseMySQL::query: 1062 - Duplicate entry '0' for key 1 SQL=INSERT INTO `jos_content` ( `id`,`title`,`alias`,`introtext`,`fulltext`,`state`,`sectionid`,`mask`,`catid`,`created`,`created_by`,`created_by_alias`,`checked_out`,`checked_out_time`,`publish_up`,`publish_down`,`attribs`,`version`,`metakey`,`metadesc`,`metadata`,`access` ) VALUES ( '0','Obaveštenje za članove kluba - utakmice za vikend','dasdasaasdasdasdasdasasd','
dqweqweqweqweqw qweqwe qw qwe
','','1','0','0','0','2010-10-02 08:58:12','62','','0','0','2010-10-02 08:58:12','0000-00-00 00:00:00','show_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_vote=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nlanguage=\nkeyref=\nreadmore=','1','','','robots=\nauthor=','0' )
The problem is that I cannot update changes to my article or add new one.
Joomla uses "insert" instaead of "update" sql statement and does not incremetn primarz key value.
Sql querry always use 0 value for id of new article. Recentlz my hosting provider switched to new mzsql version , i think it is 5.
thanks in advance!!
500 - An error has occurred!
JDatabaseMySQL::query: 1062 - Duplicate entry '0' for key 1 SQL=INSERT INTO `jos_content` ( `id`,`title`,`alias`,`introtext`,`fulltext`,`state`,`sectionid`,`mask`,`catid`,`created`,`created_by`,`created_by_alias`,`checked_out`,`checked_out_time`,`publish_up`,`publish_down`,`attribs`,`version`,`metakey`,`metadesc`,`metadata`,`access` ) VALUES ( '0','Obaveštenje za članove kluba - utakmice za vikend','dasdasaasdasdasdasdasasd','
dqweqweqweqweqw qweqwe qw qwe
','','1','0','0','0','2010-10-02 08:58:12','62','','0','0','2010-10-02 08:58:12','0000-00-00 00:00:00','show_title=\nlink_titles=\nshow_intro=\nshow_section=\nlink_section=\nshow_category=\nlink_category=\nshow_vote=\nshow_author=\nshow_create_date=\nshow_modify_date=\nshow_pdf_icon=\nshow_print_icon=\nshow_email_icon=\nlanguage=\nkeyref=\nreadmore=','1','','','robots=\nauthor=','0' )
The problem is that I cannot update changes to my article or add new one.
Joomla uses "insert" instaead of "update" sql statement and does not incremetn primarz key value.
Sql querry always use 0 value for id of new article. Recentlz my hosting provider switched to new mzsql version , i think it is 5.
thanks in advance!!
Advertisement
- toivo
- Joomla! Master
- Posts: 18246
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: 500 - An error has occurred!
Joomla does not increment the key value but it happens automatically in MySQL with each INSERT, if the option Auto Inc is set in the column id of the table jos_content. You can set it if you have administrative access to your database. However, if the id column of the content table is set incorrectly, something else may have gone wrong as well.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Oct 02, 2010 9:05 am
Re: 500 - An error has occurred!
Auto inc is off in my database for "id" field. I tried to set it on and got duplicate entry key error for value 1 or something similar. Shouldn't "id" field be omitted from the query if autoincrement is on??
Is it known thing that "id" field of table jos_content should be set to auto inc.
sorry for begeener questions?:)
thanks!
Is it known thing that "id" field of table jos_content should be set to auto inc.
sorry for begeener questions?:)
thanks!
- toivo
- Joomla! Master
- Posts: 18246
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: 500 - An error has occurred!
The id field of jos_content and almost all the other tables is set to 'auto inc' by default. After the INSERT statement the database is expected to return to Joomla the id of the newly added row. If the primary key is not set to 'auto inc', a zero is returned, and, as you noticed, the next INSERT statement reports a problem with a duplicate key.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Oct 02, 2010 9:05 am
Re: 500 - An error has occurred!
I am using navicat tool to set auto inc in DB in jos_content table.
When I want to apply auto inc it reports errer 1062 duplicate entry 53 for key 1.
I tried with heidiSql and same happens
When I want to apply auto inc it reports errer 1062 duplicate entry 53 for key 1.
I tried with heidiSql and same happens
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Oct 02, 2010 9:05 am
Re: 500 - An error has occurred!
I checked primary key coumn for duplicate entries, and all entries are uniquezarkozunic wrote:I am using navicat tool to set auto inc in DB in jos_content table.
When I want to apply auto inc it reports errer 1062 duplicate entry 53 for key 1.
I tried with heidiSql and same happens
- toivo
- Joomla! Master
- Posts: 18246
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: 500 - An error has occurred!
The error can happen if the field 'Auto Increment' has been reset in the table definition.
In MySQL Administrator, the table definitions have the tab Advanced Options and a field 'Auto Increment' with the explanation 'The initial AUTO_INCREMENT value for the table'. Find the largest value of the id field in your table and copy that value to this field. When you add the next page and the Auto Inc option is ON, as it should be, MySQL will set the id of the new page to the current value of the field 'Auto Increment' + 1.
In MySQL Administrator, the table definitions have the tab Advanced Options and a field 'Auto Increment' with the explanation 'The initial AUTO_INCREMENT value for the table'. Find the largest value of the id field in your table and copy that value to this field. When you add the next page and the Auto Inc option is ON, as it should be, MySQL will set the id of the new page to the current value of the field 'Auto Increment' + 1.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sat Oct 02, 2010 9:05 am
Re: 500 - An error has occurred!
I fixed it. deafult value wAS zero for the field and there was one record in table with zero primary kez value. I just changed that value to other unique value and then i could apply auto inc.
now adding areticles works. Thanks!!!!
now adding areticles works. Thanks!!!!
- freeclup
- Joomla! Enthusiast
- Posts: 105
- Joined: Fri Jan 27, 2012 9:16 am
Re: 500 - An error has occurred!
error
JDatabaseMySQLi::query: 1062 - Duplicate entry '0' for key 1 SQL=INSERT INTO qj4yp_readlesstext (`id`,`rtable`,`rid`,`hash`,`char`,`word`,`sentence`,`paragraph`,`image_tag_start_pos`,`image_tag_length`,`image_url`,`thumbnail_url`) VALUES ('0','com_content','3357','72eb8a7dbe7bf5034ba0aa0b8f227669','0','1306','0','0','80','104','0','0') ON DUPLICATE KEY UPDATE `id`='0',`rtable`='com_content',`rid`='3357',`hash`='72eb8a7dbe7bf5034ba0aa0b8f227669',`char`='0',`word`='1306',`sentence`='0',`paragraph`='0',`image_tag_start_pos`='80',`image_tag_length`='104',`image_url`='0',`thumbnail_
what happend !!when i run Debug Settings ->Debug System=on show this error
i can trust this code?
JDatabaseMySQLi::query: 1062 - Duplicate entry '0' for key 1 SQL=INSERT INTO qj4yp_readlesstext (`id`,`rtable`,`rid`,`hash`,`char`,`word`,`sentence`,`paragraph`,`image_tag_start_pos`,`image_tag_length`,`image_url`,`thumbnail_url`) VALUES ('0','com_content','3357','72eb8a7dbe7bf5034ba0aa0b8f227669','0','1306','0','0','80','104','0','0') ON DUPLICATE KEY UPDATE `id`='0',`rtable`='com_content',`rid`='3357',`hash`='72eb8a7dbe7bf5034ba0aa0b8f227669',`char`='0',`word`='1306',`sentence`='0',`paragraph`='0',`image_tag_start_pos`='80',`image_tag_length`='104',`image_url`='0',`thumbnail_
what happend !!when i run Debug Settings ->Debug System=on show this error


Code: Select all
JFactory::getSession()->set('com_docman.fix.the.session.bug', microtime(true));
Advertisement