Scenario:
I have two tables (Parent and Child relationship) = (tblreqslip, tblreqdetails)
tblreqslip = column fields (parent_id, client_name, date)
tblreqdetails = column fields (child_id, parent_id, subtotals)
Needs help:
In getting all the values in my child table (field ="subtotals") and add them all up "simple addition Math function".
Note: My child tblreqdetails field =(differ in values) Ex: Parent ID no="1" has child field value of 10 subtotal fields, Parent ID no="2" has a child field value of 15 subtotal fields.
Here is where I am stuck at:
$p_id=$_GET['parent_id']; //get from Post URl
$query = "SELECT * FROM tblreqdetails WHERE child_id='$p_id'";
$select = mysql_query($query) or die(mysql_error());
$rw = mysql_fetch_array($select);
(I am loosing a line here to get the values from "subtotal" field, ADD them all up no matter how many are the subtotal values in the field and just echo the TOTAL amount) Ex: ID="1" $TOTAL value =(200.50 + 1000 + 3000 .... so on till how many subtotal my child table has a value depending on my Parent ID)
Thanks so Much in Advance.