0

我有这个查询我正在尝试写入某个表,我已经通过取出几乎所有不同的值和变量来测试它,只留下用户名 wmy0 和 wmy0t 并且它成功查询,但是现在当我尝试做这一切它不会查询。是的,必须在我的数据库中拥有所有这些列。

还有没有更简单的方法可以做到这一点?如果你想了解更多关于我想要完成的事情,你可以访问

http://173.254.78.193/cash-flow-plan.php 

查看我正在处理的确切页面。这些是我试图插入名为cash_flow_plan. 我 100% 确定这是一个问题,比如......我有一个额外的逗号......或者在一个不应该出现的数字的末尾......但我一直在寻找几个小时......我可以'找不到它。所以现在我在这里试图找到一个更好的解决方案。

$sql="INSERT INTO $tbl_name (username, wmyt000, wmy1100t, wmy2000t, wmy0, wmy0t, wmy1, 
wmy1t, wmy2, wmy2t, wmy3, wmy3t, wmy4, wmy4t, wmy5, wmy5t, wmy6, wmy6t, wmy7, wmy7t, wmy8, 
wmy8t, wmy9, wmy9t, wmy10, wmy10t, wmy11, wmy11t, wmy12, wmy12t, wmy13, wmy13t, wmy14, 
wmy14t, wmy15, wmy15t, wmy16, wmy16t, wmy17, wmy17t, wmy18, wmy18t, wmy19, wmy19t, wmy20, 
wmy20t, wmy21, wmy21t, wmy22, wmy22t, wmy23, wmy23t, wmy24, wmy24t, wmy25, wmy25t, wmy26, 
wmy26t, wmy27, wmy27t, wmy28, wmy28t, wmy29, wmy29t, wmy30, wmy30t, wmy31, wmy31t, wmy32, 
wmy32t, wmy33, wmy33t, wmy34, wmy34t, wmy35, wmy35t, wmy36, wmy36t, wmy37, wmy37t, wmy38, 
wmy38t, wmy39, wmy39t, wmy40, wmy40t, wmy41, wmy41t, wmy42, wmy42t, wmy43, wmy43t, wmy44, 
wmy44t, wmy45, wmy45t, wmy46, wmy46t, wmy47, wmy47t, wmy48, wmy48t, wmy49, wmy49t, wmy50, 
wmy50t, wmy51, wmy51t, wmy52, wmy52t, wmy53, wmy53t, wmy54, wmy54t, wmy55, wmy55t, wmy56, 
wmy56t, wmy57, wmy57t, wmy58, wmy58t, wmy59, wmy59t, wmy60, wmy60t, wmy61, wmy61t, wmy62, 
wmy62t, wmy63, wmy63t, wmy64, wmy64t, wmy65, wmy65t, wmy66, wmy66t, wmy67, wmy67t, wmy68, 
wmy68t, wmy69, wmy69t, wmy70, wmy70t, wmy71, wmy71t, wmy72, wmy72t, wmy73, wmy73t, wmy74, 
wmy74t, wmy75, wmy75t, wmy76, wmy76t, wmy77, wmy77t, wmy78, wmy78t, wmy79, wmy79t, wmy80, 
wmy80t, wmy81, wmy81t, wmy82, wmy82t, wmy83, wmy83t, wmy84, wmy84t, wmy85, wmy85t, wmy86, 
wmy86t, wmy87, wmy87t, wmy88, wmy88t, wmy89, wmy89t, wmy90, wmy90t, wmy91, wmy91t, wmy92, 
wmy92t, wmy93, wmy93t, wmy94, wmy94t, wmy95, wmy95t, wmy96, wmy96t, wmy97, wmy97t, wmy98, 
wmy98t, wmy99, wmy99t, wmy100, wmy100t, wmy101, wmy101t, wmy102, wmy102t, wmy103, wmy103t, 
wmy104, wmy104t, wmy105, wmy105t, wmy106, wmy106t, wmy107, wmy107t, wmy108, wmy108t, wmy109, 
wmy109t, wmy110, wmy110t, wmy111, wmy111t, wmy112, wmy112t, wmy113, wmy113t, wmy114, wmy114t,
wmy115, wmy115t, wmy116, wmy116t, wmy117, wmy117t, wmy118, wmy118t, wmy119, wmy119t, wmy120, 
wmy120t, wmy121, wmy121t, wmy122, wmy122t, wmy123, wmy123t, wmy124, wmy124t, wmy125, wmy125t,
wmy126, wmy126t, wmy127, wmy127t, wmy128, wmy128t, wmy129, wmy129t, wmy130, wmy130t, wmy131, 
wmy131t, wmy132, wmy132t, wmy133, wmy133t, wmy134, wmy134t, wmy135, wmy135t, wmy136, wmy136t, 
wmy137, wmy137t, wmy138, wmy138t, wmy139, wmy139t, wmy140, wmy140t, wmy141, wmy141t, wmy142, 
wmy142t, wmy143, wmy143t, wmy144, wmy144t, wmy145, wmy145t, wmy146, wmy146t, wmy147, wmy147t, 
wmy148, wmy148t, wmy149, wmy149t, wmy150, wmy150t, wmy151, wmy151t, wmy152, wmy152t, wmy153, 
wmy153t, wmy154, wmy154t, wmy155, wmy155t, wmy156, wmy156t, wmy157, wmy157t, wmy158, wmy158t, 
wmy159, wmy159t, wmy160, wmy160t, wmy161, wmy161t, wmy162, wmy162t, wmy163, wmy163t, wmy164, 
wmy164t, wmy165, wmy165t, wmy166, wmy166t, wmy167, wmy167t, wmy168, wmy168t, wmy169, wmy169t, 
wmy170, wmy170t, wmy171, wmy171t, wmy172, wmy172t, wmy173, wmy173t, wmy174, wmy184t, wmy175, 
wmy175t, wmy176, wmy176t, wmy177, wmy177t, wmy178, wmy178t, wmy179, wmy179t, wmy180, wmy180t, 
wmy181, wmy181t, wmy182, wmy182t, wmy183, wmy183t, wmy184, wmy184t, wmy185, wmy185t, wmy186, 
wmy186t, wmy187, wmy187t, wmy188, wmy188t, wmy189, wmy189t, wmy190, wmy190t, wmy191, wmy191t, 
wmy192, wmy192t, wmy193, wmy193t, wmy194, wmy194t, wmy195, wmy195t, wmy196, wmy196t, wmy197, 
wmy197t, wmy198, wmy198t, wmy199, wmy199t, wmy200, wmy200t, wmy201, wmy201t, wmy202, wmy202t, 
wmy203, wmy203t, wmy204, wmy204t, wmy205, wmy205t, wmy206, wmy206t, wmy207, wmy207t, wmy208,
wmy208t, wmy209, wmy209t, wmy210, wmy210t, wmy211, wmy211t, wmy212, wmy212t, wmy213, wmy213t, 
wmy214, wmy214t, wmy215, wmy215t, wmy216, wmy216t, wmy217, wmy217t, wmy218, wmy218t, wmy219, 
wmy219t,wmy220, wmy220t, wmy221, wmy221t, wmy222, wmy222t, wmy223, wmy223t, wmy224, wmy224t, 
wmy225, wmy225t, wmy226, wmy226t, wmy227, wmy227t, wmy228, wmy228t, wmy229, wmy229t, wmy230, 
wmy230t) 



VALUES ('Aaron', '$_POST[wmyt000]', '$_POST[wmy1100t]', '$_POST[wmy2000t]', '$_POST[wmy0]',   
'$_POST[wmy0t]', '$_POST[wmy1]', '$_POST[wmy1t]', '$_POST[wmy2]', '$_POST[wmy2t]', '$_POST[wmy3]',    
'$_POST[wmy3t]', '$_POST[wmy4]', '$_POST[wmy4t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
NULL, NULL, '$_POST[wmy10]',  '$_POST[wmy10t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy20]', '$_POST[wmy20t]', 
'$_POST[wmy21]', '$_POST[wmy21t]', '$_POST[wmy22]', '$_POST[wmy22t]', '$_POST[wmy23]', '$_POST[wmy23t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy40]', '$_POST[wmy40t]', '$_POST[wmy41]', '$_POST[wmy41t]', '$_POST[wmy42]', '$_POST[wmy42t]', '$_POST[wmy43]', '$_POST[wmy43t]', '$_POST[wmy44]', '$_POST[wmy44t]', '$_POST[wmy45]', '$_POST[wmy45t]', '$_POST[wmy46]', '$_POST[wmy46t]', '$_POST[wmy47]', '$_POST[wmy47t]', '$_POST[wmy48]', '$_POST[wmy48t]', '$_POST[wmy49]', '$_POST[wmy49t]', '$_POST[wmy50]', '$_POST[wmy50t]', '$_POST[wmy51]', '$_POST[wmy51t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy60]', '$_POST[wmy60t]', '$_POST[wmy61]', '$_POST[wmy61t]', '$_POST[wmy62]', '$_POST[wmy62t]', '$_POST[wmy63]', '$_POST[wmy63t]', '$_POST[wmy64]', '$_POST[wmy64t]', '$_POST[wmy65]', '$_POST[wmy65t]', '$_POST[wmy66]', '$_POST[wmy66t]', '$_POST[wmy67]', '$_POST[wmy67t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy80]', '$_POST[wmy80t]', '$_POST[wmy81]', '$_POST[wmy81t]', '$_POST[wmy82]', '$_POST[wmy82t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,  '$_POST[wmy90]', '$_POST[wmy90t]', '$_POST[wmy91]', '$_POST[wmy91t]', '$_POST[wmy92]', '$_POST[wmy92t]', '$_POST[wmy93]', '$_POST[wmy93t]', '$_POST[wmy94]', '$_POST[wmy94t]', '$_POST[wmy95]', '$_POST[wmy95t]', '$_POST[wmy96]', '$_POST[wmy96t]', '$_POST[wmy97]', '$_POST[wmy97t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy110]', '$_POST[wmy110t]',  '$_POST[wmy111]', '$_POST[wmy111t]', '$_POST[wmy112]', '$_POST[wmy112t]', '$_POST[wmy113]', '$_POST[wmy113t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy130]', '$_POST[wmy130t]', '$_POST[wmy131]', '$_POST[wmy131t]', '$_POST[wmy132]', '$_POST[wmy132t]', '$_POST[wmy133]', '$_POST[wmy133t]', '$_POST[wmy134]', '$_POST[wmy134t]', '$_POST[wmy135]', '$_POST[wmy135t]', '$_POST[wmy136]', '$_POST[wmy136t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,  '$_POST[wmy150]', '$_POST[wmy150t]', '$_POST[wmy151]', '$_POST[wmy151t]', '$_POST[wmy152]', '$_POST[wmy152t]', '$_POST[wmy153]', '$_POST[wmy153t]', '$_POST[wmy154]', '$_POST[wmy154t]', '$_POST[wmy155]', '$_POST[wmy155t]', '$_POST[wmy156]', '$_POST[wmy156t]', '$_POST[wmy157]', '$_POST[wmy157t]', '$_POST[wmy158]', '$_POST[wmy158t]', '$_POST[wmy159]', '$_POST[wmy159t]', '$_POST[wmy160]', '$_POST[wmy160t]', '$_POST[wmy161]', '$_POST[wmy161t]', '$_POST[wmy162]', '$_POST[wmy162t]', '$_POST[wmy163]', '$_POST[wmy163t]', '$_POST[wmy164]', '$_POST[wmy164t]', '$_POST[wmy165]', '$_POST[wmy165t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy170]', '$_POST[wmy170t]', '$_POST[wmy171]', '$_POST[wmy171t]', '$_POST[wmy172]', '$_POST[wmy172t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '$_POST[wmy190]', '$_POST[wmy190t]', '$_POST[wmy191]', '$_POST[wmy191t]', '$_POST[wmy192]', '$_POST[wmy192t]', '$_POST[wmy193]', '$_POST[wmy193t]', '$_POST[wmy194]', '$_POST[wmy194t]', '$_POST[wmy195]', '$_POST[wmy195t]', '$_POST[wmy196]', '$_POST[wmy196t]', '$_POST[wmy197]', '$_POST[wmy197t]', '$_POST[wmy198]', '$_POST[wmy198t]', '$_POST[wmy199]', '$_POST[wmy199t]', '$_POST[wmy200]', '$_POST[wmy200t]', '$_POST[wmy201]', '$_POST[wmy201t]', '$_POST[wmy202]', '$_POST[wmy202t]', '$_POST[wmy203]', '$_POST[wmy203t]', '$_POST[wmy204]', '$_POST[wmy204t]', '$_POST[wmy205]', '$_POST[wmy205t]', '$_POST[wmy206]', '$_POST[wmy206t]', '$_POST[wmy207]', '$_POST[wmy207t]', '$_POST[wmy208]', '$_POST[wmy208t]', '$_POST[wmy209]', '$_POST[wmy209t]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)";

$result=mysql_query($sql);

如果您看到我在哪里设置了 NULL 值,那是因为我目前没有在输入页面上使用它。(但稍后会使用它,所以我需要它们)

4

2 回答 2

2

我将代码复制到 IDE 中,没有发现语法错误。我唯一可以建议的是,在执行时您的代码中有一个空白变量。我的建议是在运行查询之前做一个- 并在值部分echo $sql;寻找看起来像的东西。, '',

更好的方法是使用 PDO 和准备好的语句 - 可能与命名占位符一起使用:

insert into $tbl_name (col1, col2) values (:col1, :col2)

您可以在其中避免注入攻击,并bind->在添加之前在每个参数上使用 - 这意味着您应该在绑定之前强制验证每个参数。

于 2012-08-13T11:36:52.900 回答
0

回显查询,然后运行程序,然后复制您尝试执行的查询并将其粘贴到 mysql 提示符中,我认为这将帮助您找到问题所在的确切位置......

于 2012-08-13T11:47:08.427 回答