This is a very simple insert problem, but there is a problem. Please help us to see where the problem exists.
Last Update:2014-03-27
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, dw is a very simple insert problem, but there is a problem, please help us to see what is wrong
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!