PHP Foreach Loop Issue...

Posted by Calibur747, 02-12-2011, 05:09 PM
Hello WHT, I am having an issue where some users are not having an invoice created when this script runs. The gist of the system is that the user can charge items to their account all month long and then on the 1st of the next month, have all the previous months pending charges (balancepending) become balance due (balancedue). We add $2 to the balance due for our fee and then create an invoice. Now, I am selecting all users and going through them in a foreach loop for an array. Randomly however some are not being included in the invoice creation process, and still have their balancepending and no balancedue ( aka it's like the whole script skipped a few random accounts ). Can anyone see an error or lapse in the code? Thank you for the assist.

Posted by Hostify Networks, 02-12-2011, 07:21 PM
I've cleaned up the code for you:

Posted by Calibur747, 02-12-2011, 09:55 PM
Thank you kindly, do you think this will minimize the chance of accounts being skipped? Definitely looks a lot cleaner

Posted by Hostify Networks, 02-12-2011, 10:12 PM
Accounts won't be skipped (unless the script times out...adding set_time_limit(0) to the top of the script will fix that). Test it first before adding to the live site, of course.

Was this answer helpful?

 Print this Article

Also Read

PTZ control queue to a website in script / code

Posted by magi5, 05-05-2007, 08:41 PMHello. Does anybody know about a "Pan/Tilt/Zoom control...

php help

Posted by BattleMasterGaara, 02-06-2011, 10:44 PMWhat code do i use just to switch the content of...

Box Overloading

Posted by SuperHosterz, 01-13-2008, 11:56 AMI've 50 sites hosted on server all are small sites,...

worry about hidden Hostname.how ?

Posted by mixmox, 04-19-2009, 12:49 PMhello. when i use Hostname / Reverse IP Lookup and test it...

Setting up new Network, Security concern on DDOS

Posted by EricTham, 04-15-2009, 11:15 PMI am intending to setup a network as the following:...