This is a very simple insert problem, but there is a problem. Please help us to see where the problem exists.

Source: Internet
Author: User
This is a simple insert problem, but it is a problem. Please help us to see where there is a problem: insert & nbsp; into & nbsp; rc (zjbs, zjdm, gzbj, xingming, sex, minzu, zzmm, csri, csd, byyx, bysj, sxzy, whcd, xw, gzdw, gzsj, dwlb, dwxz, xzzw, xzjb, cszy, gkhy, j is a simple insert problem, but there is a problem. Please help us to see where the problem exists.
Insert into rc (zjbs, zjdm, gzbj, xingming, sex, minzu, zzmm, csri, csd, byyx, bysj, sxzy, whcd, xw, gzdw, gzsj, dwlb, dwxz, xzzw, xzjb, cszy, gkhy, jszc, zgzt, tel, zip, ys, ggqjb, ttnf, ttje, tgnf, sbnf, NF, jbzn, hgnf, chcl, lhjt, gzjl, tcsj, dblz, zxcg, isvalid, pic) values ('dsaf', 'asdf ', 'sdfasd', 'asdf', '1', 'hui ', 'asdf ', 'asdf ', 'fasdf', 'High School', 'asf', 'asdf ', 'asf', 'asdf ', 'asdf ', 'asd', 'asdf ', 'asdf', 'ffasdf ', 'advanced', 'asdf ', 'asfs', asdf, asdf, tgnf, sbnf, asdf, 'asdf ', 'asdf ', '0', '1186039175.gif ')

Print it out.

$ SQL = "insert into rc (";
$ SQL = $ SQL. "zjbs, zjdm, gzbj, xingming, sex, minzu, zzmm, csri, csd, byyx, bysj, sxzy, whcd, xw, gzdw, gzsj, dwlb, dwxz, xzzw, xzjb, cszy, gkhy, jszc, zgzt, tel, zip, ys, ggqjb, ttnf, ttje, tgnf, sbnf, NF, jbzn, hgnf, chcl, lhjt, gzjl, tcsj, dblz, zxcg, isvalid, pic ";
$ SQL = $ SQL. ") values (";
$ SQL = $ SQL. "'$ zjbs', '$ zjdm',' $ gzbj ',' $ xingming ',' $ sex ',' $ minzu ',' $ zzmm ', '$ csri',' $ csd', '$ byyx', '$ bysj', '$ sxzy', '$ whcd', '$ xw',' $ gzdw ', '$ gzsj', '$ dwlb',' $ dwxz ',' $ xzzw', '$ xzjb', '$ cszy', '$ gkhy', '$ jszc ', '$ zgzt', '$ tel', '$ zip', '$ ys', '$ ggqjb', $ ttnf, $ ttje, tgnf, sbnf, $ NF, $ jbzn, $ hgnf, '$ chcl', '$ lhjt', '$ gzjl', '$ tcsj', '$ dblz',' $ zxcg ', '0 ', '$ pic '";
$ SQL = $ SQL .")";

Here is my combination


The printed SQL statement can be directly inserted into the database on the visual interface of mysql without any exception.
But if php is used for execution, it means it will not be successful.

Let me see why

Thank you first

Online

------ Solution --------------------
1. is there an error? What's wrong?
2. you 'd better insert this code and paste it
------ Solution --------------------
Echo mysql_error ();
See what the error is.
------ Solution --------------------
$ SQL = "insert into rc (";
$ SQL = $ SQL. "zjbs, zjdm, gzbj, xingming, sex, minzu, zzmm, csri, csd, byyx, bysj, sxzy, whcd, xw, gzdw, gzsj, dwlb, dwxz, xzzw, xzjb, cszy, gkhy, jszc, zgzt, tel, zip, ys, ggqjb, ttnf, ttje, tgnf, sbnf, NF, jbzn, hgnf, chcl, lhjt, gzjl, tcsj, dblz, zxcg, isvalid, pic ";
$ SQL = $ SQL. ") values (";
$ SQL = $ SQL. "'$ zjbs', '$ zjdm',' $ gzbj ',' $ xingming ',' $ sex ',' $ minzu ',' $ zzmm ', '$ csri',' $ csd', '$ byyx', '$ bysj', '$ sxzy', '$ whcd', '$ xw',' $ gzdw ', '$ gzsj', '$ dwlb',' $ dwxz ',' $ xzzw', '$ xzjb', '$ cszy', '$ gkhy', '$ jszc ', '$ zgzt', '$ tel', '$ zip', '$ ys', '$ ggqjb', '$ ttn',' $ ttje ', 'tgnf ', 'sbnf ',' $ bbf', '$ jbzn', '$ hgnf', '$ chcl', '$ lhjt', '$ gzjl', '$ tcsj ', '$ dblz',' $ zxcg ', '0',' $ pic '";
$ SQL = $ SQL .")";
------ Solution --------------------
Gkhy ',' $ jszc', '$ zgzt', '$ tel', '$ zip', '$ ys', '$ ggqjb', $ ttnf, $ ttje, tgnf, sbnf, $ NF, $ jbzn, $ hgnf,
In this line, tgnf and sbnf variables are not added with $ or quotation marks!

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.