Multidimensional Array Confusion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Multidimensional Array Confusion

Post by JakeJ »

GAH! These things still confuse me.

I have a 2 dimensional associative array that I pull from my database. From the debts table, I pull (balance, apr, payment, type). I need to produce a payment schedule. During the loops I do of course need to subtract the payment from the balance and add accrued interest. The added problem is that there is an outside variable called $extra that needs to only be added to the first debt in the array that does not have a balance of 0. The goal of course is to pay down each debt until it gets to 0. $extra get applied to each debt when the one above it gets paid off.

I could do this with a series of database reads and writes but that's obviously a VERY inefficient way of doing things. I just can't get a grip on how to loop through a multidimensional array.

I will continue to poke away at this while I wait for your answer.

Thanks
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Multidimensional Array Confusion

Post by AbraCadaver »

A sample of the array would be helpful.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply