asaad Posted July 1, 2013 Share Posted July 1, 2013 (edited) HI all, Am new here and kind of new to php too .. this is my first post I have 2 questions:This is a MySQL database named "items" 1- Is there a way to show the sum of the blue cells using php, ie : 10 + 77 + 12 + 67 2- I will refer to Row as R and Column as C: how can I show the sum of everything ie: R1C1 + R2C1 + R3C1 + R4C1 R1C1 + R2C1 + R3C1 + R4C2 R1C1 + R2C1 + R3C1 + R4C3 R1C1 + R2C1 + R3C2 + R4C1 R1C1 + R2C1 + R3C2 + R4C2 R1C1 + R2C1 + R3C2 + R4C3 R1C1 + R2C1 + R3C3 + R4C1 R1C1 + R2C1 + R3C3 + R4C2 R1C1 + R2C1 + R3C3 + R4C3 R1C1 + R2C2 + R3C1 + R4C1 R1C1 + R2C2 + R3C1 + R4C2 R1C1 + R2C2 + R3C1 + R4C3 and so on until showing all the 256 sums Thank You Very Much in advanced Edited July 1, 2013 by asaad Quote Link to comment Share on other sites More sharing options...
chriscloyd Posted July 1, 2013 Share Posted July 1, 2013 Do those columns have any relation to each other? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted July 2, 2013 Share Posted July 2, 2013 Nested for loops. Look it up. Can't imagine why you would want to do this tho Quote Link to comment Share on other sites More sharing options...
ginerjm Posted July 2, 2013 Share Posted July 2, 2013 Suppose I have to also add: after dumping your query results to 4 arrays - one for each column's contents. Quote Link to comment Share on other sites More sharing options...
asaad Posted July 2, 2013 Author Share Posted July 2, 2013 (edited) Thanks for your replys, here is an explanation that I believe will answer your questions :the rows are Items for an online printing shop.. and the columns are the prices for different types. for example there is a type of pens for 10$,another type for 40$ ,and another for 80 and so on .. When a costumer wants to make an event he will need for example : 100 pens , 40 bags and 30 Shirts. He will enter the amount of money he has in mind for the event : Ex: 3000$The site will calculate what are the best types of pens, bags and shirt he can buy with his money ..so the real equation is :3000- ( pen type1 * 100 + bag type 1 * 40 + Shirt type 1 * 30 )= , if + or 0 then put to suggestions . 3000- ( pen type2 * 100 + bag type 1 * 40 + Shirt type 1 * 30 )= , if + or 0 then put to suggestions .and so on ..Thanks Again Edited July 2, 2013 by asaad Quote Link to comment Share on other sites More sharing options...
asaad Posted July 8, 2013 Author Share Posted July 8, 2013 No one can solve my problem :( Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.