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

Simple Apache problem

Posted by Jinovich, 03-28-2008, 10:26 AMBasically, set up a server it has no Domain only IP, it...

Got hacked or got a virus

Posted by azn_romeo_4u, 04-20-2009, 09:30 PMThis code shows up on all my pages with an index.php...

Is there a notepad type program that displays php code color format?

Posted by lexington, 09-01-2008, 09:38 AMHello, is there a (free script would be great) that acts...

Redrect - make it impossible to trace source

Posted by ntesla123, 02-10-2011, 08:51 PMHow do I make a redirect that would redirect someone to...

worry about hidden Hostname.how ?

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