Hello, I have this website I want to build for personal use but I have come to a problem. I have a database with all these rows of transactions. But each row needs some values from the previous row to calculate the values for the row. I also need this to loop again and again through each transaction until there are no more rows. So my big question is how do I take values calculate to get a number and use them on the next row again and again until there's no more rows. Thanks
I don't understand your post completely, but here's a good show. An example of how math can be grabbed, carried to the next row, and more math done to that number. <?php /** * @Author: John Mahoney * @Rights: Use as you wish! **/ // Do your mysql connect and db select stuff $rows_sql = "SELECT * FROM db_table"; $rows = mysql_query($rows_sql); // If it came back Empty Handed if (!$rows) { die('The Query Did Not Work '.mysql_error()); } $math = 0; while ($row = mysql_fetch_array($rows)) { $number_to_add = $row['row_with_math']; $math = $math+number_to_add; } echo $math; //This will should echo the Math behind the Product of All Your Rows. ?> PHP: There may be a faster more efficient way, this is just the quickest way to get you started. No one else responded to you, so I figured I would see what I can do. -