DEDECMS New content Model "error saving data to database Attach table error ' xxx ' errors" cause analysis and solution (GO)

Source: Internet
Author: User

Error saving data to database attached table ' Bc_addonarticle17 ', please submit relevant information to DEDECMS official. INSERT into ' Bc_addonarticle17 ' (Aid,typeid,redirecturl,templet,userip,body,) Values (one, one,,, 127 0 0 1,) you have a N Error in your

Today, when using the Dedecms dream system to build a station, there was an error when adding the article using the newly created custom content model, which described the following error:
The system returned an error:
Error saving data to database attached table ' Bc_addonarticle17 ', please submit relevant information to DEDECMS official. You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' require,process ' Values (' One ', ' one ', ', ', ', ' 127.0.0.1 ', ' Asdfdsaf ', ', ' ASD ', ' at line 1;
First of all know that this is a data through the form submitted to the PHP program to process the save to the database in the process of saving the database this part of the error occurred. The PHP program file "dede/article_add.php" that was submitted to the form was found, and the program segments added to handle the additional table content produced in the custom model were found:

Save to attached table
$cts = $dsql->getone ("Select addtable from ' #@__channeltype ' WHERE id= ' $channelid '");
$addtable = Trim ($cts [' addtable ']);
if (empty ($addtable))
{
$dsql->executenonequery ("DELETE from ' #@__archives ' WHERE id= ' $arcID '");
$dsql->executenonequery ("DELETE from ' #@__arctiny ' WHERE id= ' $arcID '");
ShowMsg ("The main table information for the current model [{$channelid}] could not be found and the operation could not be completed!. "," javascript:; ");
Exit ();
}
$useip = GetIP ();
$templet = Empty ($templet)? ": $templet;
$query = "INSERT into ' {$addtable} ' (aid,typeid,redirecturl,templet,userip,body{$inadd _f}) Values (' $arcID ', ' $typeid ') , ' $redirecturl ', ' $templet ', ' $useip ', ' $body ' {$inadd _v}) ';
if (! $dsql->executenonequery ($query))
{
$gerr = $dsql->geterror ();
$dsql->executenonequery ("Delete from ' #@__archives ' where id= ' $arcID '");
$dsql->executenonequery ("Delete from ' #@__arctiny ' where id= ' $arcID '");
ShowMsg ("Error saving data to database attached table ' {$addtable} ', please submit the relevant information to DEDECMS official. ". $query. Str_replace ('" ', ', $gerr), "javascript:;");
Exit ();
}

About 203 rows, the author first joins the program statement that outputs its SQL statement to see if there is an error in the production SQL INSERT statement, which links a $query variable in the string where the hint information is returned:
ShowMsg ("Error saving data to database attached table ' {$addtable} ', please submit the relevant information to DEDECMS official. ". $query. $query. Str_replace ('" ', ', $gerr), "javascript:;");
Add an article here to see the following SQL statements in the returned hints:

Error saving data to database attached table ' Bc_addonarticle17 ', please submit relevant information to DEDECMS official. INSERT into ' Bc_addonarticle17 ' (aid,typeid,redirecturl,templet,userip,body,sectitle,introduce,require,process) Values (' One-one ', ' one ', ' ', ' ', ' 127.0.0.1 ', ' Asdfdsaf ', ', ' asd ', ' ', ') have a error in your SQL syntax; Check the manual, corresponds to your MySQL server version for the right syntax to use near ' require,process ' Valu Es (' One ', ' one ', ', ', ', ' 127.0.0.1 ', ' Asdfdsaf ', ', ' asd ', ' ' at line 1 '

Check that the SQL statement found no errors on the statement, and then open the database to view the corresponding database tables is also useless error

This is not a procedural problem, but should be added to the field of the time some problems, such as the type of the field when the property is set reasonable, the name of the field is reasonable (whether the system reserved field or existing conflict, etc.);
So the day-to-day people have to check the content model options in the field to set whether there is unreasonable (core-content Model Management-modification-field management), found that no problem after considering the require or process field is the error point, then there can be two field naming problems, So I re-created a new model that changed the name of the corresponding two fields, using this new model, the article saved normally!
From the above, it is because the field name of the field we created is problematic (whether the system holds the field or exists and conflicts, etc.), and the SQL statement syntax is normal but still does not save the article properly.
In addition, some of the similar problems on the network reflect the fact that if you add a field simply by changing the " model field configuration (text mode)" column when creating a model, you do not create a field by clicking the "Add Field" button, because it is a façade, The fields in the corresponding database tables are not created correctly.

DEDECMS New content Model "error saving data to database Attach table error ' xxx ' errors" cause analysis and solution (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.