Skip to main content
Inspiring
March 26, 2012
Question

equations using php and / or javascript

  • March 26, 2012
  • 1 reply
  • 1950 views

i have a excel spreadsheet that has a basic - input one amount in column A then it adds column A to Column C to give Col D results. Well thats the rough idea.,

to basically a field comes from a mysql database then need to start the equation ( the field from the DB would be COL A)

what is the best way to do this?

This topic has been closed for replies.

1 reply

Participating Frequently
March 26, 2012

If the user is simply going to enter a single value and get the results, I would use php. If it's going to be more interactive - like they may try lots of different values, then javascript will provide a better user experience.

Inspiring
March 26, 2012

ok it is basically one amount coming from the DB and a fixed equation. What do i need to do to get going on this? are there any good tutorials out there?

Inspiring
March 26, 2012

>is this way over my head??

No. It's much easier than you think. Assuming you have already retrieved the SQL record

$D = $sql_row["montly_rent"];

$E = $D * 4

$F = $D * 52

$G = 184

$H = $E + $F + $G

$I = ($D * 15) + $G + $E

....you get the idea. Of course, use meaningful variable names, not the simple letters I used for an example.


ok i am going to look at this so the variable would be for example

$monthly = $sql_row["montly_rent"];

$deposit = $monthly * 4

$payable=$monthly *52

>Assuming you have already retrieved the SQL record

you mean the $D record from the database?

so i need to know what goes where. I was going to get  all these variable names into a form to that can be sent off to the DB in order to get the correct figures for the next page.