简体   繁体   English

试图弄清楚为什么一个sub导致27个条目进入mysql数据库

[英]Trying to figure out why a sub is causing 27 entries into a mysql database

So I have a subroutine in my software that generates a temporary invoice. 所以我的软件中有一个生成临时发票的子程序。 I really only need the temporary invoice to then add line items to it and publish the invoice for payment. 我真的只需要临时发票然后添加订单项并发布付款发票。 All works well expect the snip of code causes a number of temporary invoices to be generated. 所有工作都很好,期望代码片段导致生成许多临时发票。 I say a number because one time it will be 27 then the next time will be 26.. 25.. 20... and so on.. I don' see anything on here that would loop the sub to cause this. 我说一个数字,因为有一次它将是27然后下一次将是26 .. 25 .. 20 ......等等......我没有看到任何东西在这里会循环子导致这个。 Typically all db calls are done from a separate file and called via a sub but for reference Ive added it into the sub. 通常所有的db调用都是从一个单独的文件中完成的,并通过sub调用,但是作为参考,我已将它添加到sub中。 ** I have removed parts of the code at a time to see if it was causing it, found no issues. **我一次删除部分代码,看它是否导致它,发现没有问题。 I have also tried adding a temp invoice via the sub call from another page without issue. 我还尝试通过来自另一个页面的子调用添加临时发票而没有问题。 My issue is in this code somewhere! 我的问题是在这个代码的某个地方!

Instead of all those selects, do just one?? 而不是所有这些选择,只做一个?

$sql = "SELECT fname, lname, ...
    FROM customer
    WHERE customer_id = '$customer_id'";

The result is an array of fname, lname, etc. 结果是一个fname,lname等数组。

I ending up figuring out the issue with some help from a user over at reddit. 我最后通过reddit上的用户提供了一些帮助来解决问题。 Since Im using mod rewrite apparently items were being called under the link causing the main program to run X extra times and create the random junk entrees. 因为我使用mod重写显然在链接下调用了项目,导致主程序额外运行X并创建随机垃圾主菜。 Needless to say it had nothing to do with the script at all! 不用说它根本与脚本无关!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 试图使用vb.net将记录输入到mysql数据库中,但它不起作用,我无法弄清为什么 - Trying to enter records into a mysql database using vb.net but its not working and I cant figure out why 重写mysql查询返回意外结果,试图找出原因 - rewritten mysql query returning unexpected results, trying to figure out why 我想弄清楚 MySQL 查询 - I'm trying to figure out MySQL Query 试图找出一个好的数据库设计 - trying to figure out a good database design 试图找出如何编写SQL查询以返回mysql数据库的两个表的非交叉,遇到问题 - Trying to figure out how to write an SQL query to return the nonintersection of two tables for a mysql database, having trouble MySql,试图弄清楚我的某些查询有时运行得慢很多,需要一些证明 - MySql, trying to figure out my some queries run a lot slower sometimes, need some proof why 无法弄清楚为什么MySql数据库语法无法编译 - Can't figure out why mySql database syntax won't compile PHP中的多个MySQL查询。 我试图弄清楚如何使用单选按钮在数据库中搜索多个查询 - Multiple MySQL query in php. I'm trying to figure out how to use radio buttons to search for multiple queries in a database 试图弄清楚如何在Java EE 6中使用EasyPHP(MySQL) - Trying to figure out how to use EasyPHP (MySQL) with Java EE 6 试图弄清楚MySQL查询的作用(不是我的) - Trying to figure out what a MySQL query does (not mine)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM