calculate two fields
Posted: Sat Jan 12, 2008 2:00 pm
i have a web page that displays some data from the database.
In my SQL table there are 4 users , for each of them there are two values of the current salary and the new salary
now when i select a user using the select field the data of the salaries is being presented.
I wanted to add another field that will add the current salary to the new salary so I added a line as follows :
echo "<td>" . $row['salary_cur'] + $row['salary_new'] ."</td>";
but in fact , i'm able to see only the value of ['salary_new'] so no calculation was effected.
Please help me to change this line so i will be able to see the result.
(i forgot to tell that i;m using Ajax here so the request is being sent from the html through a java script and then to the php. Maybe I'm not able to do calculations since Ajax is involved ? )
In my SQL table there are 4 users , for each of them there are two values of the current salary and the new salary
now when i select a user using the select field the data of the salaries is being presented.
I wanted to add another field that will add the current salary to the new salary so I added a line as follows :
echo "<td>" . $row['salary_cur'] + $row['salary_new'] ."</td>";
but in fact , i'm able to see only the value of ['salary_new'] so no calculation was effected.
Please help me to change this line so i will be able to see the result.
(i forgot to tell that i;m using Ajax here so the request is being sent from the html through a java script and then to the php. Maybe I'm not able to do calculations since Ajax is involved ? )