PHP - Calculation Problem In Php
This is a bit of a puzzle. Look at the sum and result below:
Code: [Select] $markTotal += ($session['Mark'] / 100 * $session['SessionWeight']); Result on Browser with explanation to help you: Module: CHI2550 - Modern Database Applications 35% (this is $markTotal) ... This is where I want add the total mark for 100% Session: AAB 100% (this is $session['Mark']) 10% (this is $session['SessionWeight']) Session: AAE 50% (this is $session['Mark']) 50% (this is $session['SessionWeight']) All percentage marks above are just add ons. As you can see the answer to the calculation above is right, the answer is 35 as it adds up the two session marks, divide by 100 and then times it by the total amount of the percentage. But I want to include a total mark where except it is out of the total session percentage (60% for above example as one Session is 40% and the other is 20%), it is out of a 100% but I can not work as simple as that as in above example one session is worth more than other. The total mark out of 100% of the above example should be 65%, but how do I achieve this in my calculation. It is not as simple as dividing the $session['Mark'] because one session is worth more than the other. So the above example will have 2 marks: one mark out of total percentage of the Sessions which for the above example is 35% and second mark is out of the full 100% of the module which is 65%. Thank you and any help is much appreciated Similar TutorialsHi, I have a calculation issue in my php. Below is my code: Code: [Select] $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)){ $moduletotal += $row['Mark']; $modulemark = (int)($moduletotal); //Above here is the calculation for add in the Marks of all the sessions //Below is the code of the display of the query output if($studentId != $row['StudentUsername']) { $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})"; } if($courseId != $row['CourseId']) { $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <br><strong>Year:</strong> {$row['Year']}</p>"; } if($moduleId != $row['ModuleId']) { $moduleId = $row['ModuleId']; $output .= "<p><br><strong>Module:</strong> {$row['ModuleId']} - {$row['ModuleName']} $modulemark</p>"; } $output .= "<p><strong>Session:</strong> {$row['SessionId']} {$row['Mark']}</p>"; } Student: Mayur Patel (u0867587) Course: INFO101 - Bsc Information Communication Technology Year: 3 Module: CHI2550 - Modern Database Applications 72 (72 is the answer to the calculation for the first module but this is incorrect at it should also add the 67 and thus become 139) Session: AAB 72 Session: AAE 67 Module: CHI2513 - Systems Strategy 200 (200 is the answer to the calculation for this module but this is incorrect it should be only 61. But what it has done is that it has added the 72 and 67 from the first module and added it with the 61 in this module) Session: AAD 61 SO WHAT MY QUESTION IS THAT HOW CAN I FIND THE TOTAL OF EACH MODULE MARK WHICH THE VARIABLE $modulemark = (int)($moduletotal); IS TRYING TO DO BY ADDING UP ALL THE SESSIONS MARKS WITHIN EACH MODULE. I HAVE TRIED USING SUM(gr.Mark) in the query and using GROUP BY SessionId, ModuleId, StudentUsername, and CourseId but it ends up not being able to display any records. That is why I want to do the calculation using php rather than SQL. BELOW IS THE QUERY IF YOU WANT TO SEE IT: Code: [Select] $query = " SELECT st.CourseId, c.CourseName, st.Year, st.StudentUsername, st.StudentForename, st.StudentSurname, s.ModuleId, m.ModuleName, m.Credits, s.SessionId, s.SessionWeight, gr.Mark, gr.Grade FROM Course c INNER JOIN Student st ON c.CourseId = st.CourseId JOIN Grade_Report gr ON st.StudentId = gr.StudentId JOIN Session s ON gr.SessionId = s.SessionId JOIN Module m ON s.ModuleId = m.ModuleId WHERE (st.StudentUsername = '".mysql_real_escape_string($studentid)."') ORDER BY c.CourseName, st.StudentUsername, m.ModuleName, s.SessionId "; This code was given to me by mjdamato to help display a student and the course that student has take and within that the modules in the course and the sessions in course including module mark and grade and student's session marks and grades. I am very weak on php code as I have only done it once and that was following a php workbook 2 years ago. I am more of a database specialist. Below is the code given to me and you can also download the code from the attachment: Code: [Select] <?php function outputModule($moduleID, $moduleName, $sessionData) { if(!count($sessionData)) { return false; } $markTotal = 0; $markGrade = 0; $weightSession = 0; $grade = ""; $sessionsHTML = ""; foreach($sessionData as $session) { $sessionsHTML .= "<p><strong>Session:</strong> {$session['SessionId']} <br><strong>Session Mark:</strong> {$session['Mark']}</strong> <br><strong>Session Weight Contribution</strong> {$session['SessionWeight']}%</p>\n"; $markTotal += round($session['Mark'] / 100 * $session['SessionWeight']); $weightSession += ($session['SessionWeight']); $markGrade = round($markTotal / $weightSession * 100); if ($markGrade >= 70){ $grade = "A";} else if ($markGrade >= 60 && $markGrade <= 69){ $grade = "B";} else if ($markGrade >= 50 && $markGrade <= 59){ $grade = "C";} else if ($markGrade >= 40 && $markGrade <= 49){ $grade = "D";} else if ($markGrade >= 30 && $markGrade <= 39){ $grade = "E";} else if ($markGrade >= 0 && $markGrade <= 29){ $grade = "F";} } $moduleHTML = "<p><br><strong>Module:</strong> {$moduleID} - {$moduleName} <br><strong>Module Mark:</strong> {$markTotal} <br><strong>Mark Percentage:</strong> {$markGrade} <br><strong>Grade:</strong> {$grade} </p>\n"; return $moduleHTML . $sessionsHTML; } $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)) { if($studentId != $row['StudentUsername']) { //Student has changed $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})\n"; } if($courseId != $row['CourseId']) { //Course has changed $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <strong>Course Mark</strong> <strong>Grade</strong> <br><strong>Year:</strong> {$row['Year']}</p>\n"; } if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } //Get output for last module $output .= outputModule($moduleId, $moduleName, $sessionsAry); //Display the output echo $output; } } ?> Below the what this code outputs: Student: Mayur Patel (u0867587) Course: INFO101 - Bsc Information Communication Technology Course Mark Year: 3 Module: CHI2550 - Modern Database Applications Module Mark: 41 Mark Percentage: 68 Grade: B Session: AAB Session Mark: 72 Session Weight Contribution 20% Session: AAE Session Mark: 67 Session Weight Contribution 40% Module: CHI2513 - Systems Strategy Module Mark: 31 Mark Percentage: 62 Grade: B Session: AAD Session Mark: 61 Session Weight Contribution 50% If you look above it shows that there is nothing in the Course Mark: section, what Course Mark is suppose to do is total up all the module mark percentages and then divide it by the number of modules. So the calculation will be adding up all the Code: [Select] $markGrade and dividing it by count Code: [Select] $ModuleID. In examle above it will be 68 (mark percentage for 1st module) + 62 (mark percentage for 2nd module) / 2 (number of modules in the course). So the Course Mark should equal 65. The problem is that all of the calculations are in the foreach loop but where the course details and where the course marks are going to be placed are in the while loop. So the problem is that if the total Course Mark (lets say we call in $totalCourse) is displayed in the while loop it will provide an undifined index as the calculation will be placed with the other calculations in the foreach loop which is outside the while loop, if I do the calculation with in the while loop, it will only choose the 1st module mark percentage and divdie it by the first module only, this is obviously incorrect as it sohuld try and do this for all modules hence why my calculations are in the foreach loop which does this. So how will change the code so that the course details can go from the while loop and be placed in the foreach loop so then I can include the calculation in the foreach loop. Thank You and hopefully you understand it, just read it very carefully to understand it, it is very simple what I want to achieve but I do not know how to do it. [attachment deleted by admin] Hi Guys, i am trying to get my head around doing a calculation for the total and getting the discount from each row and display the total. I am using both mySql and php. How do i get the TOTAL BALANCE (this is = total balance - the discount) and the TOTAL PAYMENT DUE (this is = TOTAL CLIENT PAYMENT - TOTAL BALANCE). Please note that the discount settings are different for each row and there are an number of different rows. The table is as follows: Code: [Select] `invoiceID` int(11) NOT NULL AUTO_INCREMENT, `USERID` varchar(255) NOT NULL DEFAULT '', `CLIENTID` varchar(150) NOT NULL DEFAULT '', `amount` decimal(10,2) NOT NULL DEFAULT '0.00', `Discount` double(4,2) NOT NULL DEFAULT '0.00' The page code is as follows: <?php $query = "SELECT ID FROM clients WHERE username = '$u'"; $result = mysql_query($query); if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)){ $USERID = $row['ID']; $client = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM payment WHERE USERID = '$USERID' AND CLIENTID = '$client'"; $result = mysql_query($query); $num=mysql_numrows($result); ?> <table> <thead><tr> <th>Invoice ID</th> <th>Discount</th> <th>Cost</th> <th>Balance</th> </tr> </thead> <tbody> <?php $i=0; while ($i < $num) { $invoiceID=mysql_result($result,$i,"invoiceID"); $USERID=mysql_result($result,$i,"USERID"); $CLIENTID=mysql_result($result,$i,"CLIENTID"); $amount=mysql_result($result,$i,"amount"); $Discount=mysql_result($result,$i,"Discount"); $balance = $amount - (($amount/100)*$Discount); ?> <tr> <td><?php echo $invoiceID; ?></td> <td><?php echo $Discount; ?></td> <td><?php echo $amount; ?></td> <td><?php echo number_format($balance,2); ?></td> </tr> <?php $i++; } } } $CLIENTID = mysql_real_escape_string($_GET['id']); $USERID = mysql_real_escape_string($_GET['USERID']); $sql = "SELECT SUM(amount) AS TOTALPAYMENT FROM payment WHERE CLIENTID = '".$_GET['id']."' AND USERID = '".$_GET['USERID']."'" ; $resulte = mysql_query($sql); mysql_close(); if(mysql_num_rows($resulte)) { while($row = mysql_fetch_assoc($resulte)){ $amount = $row['amount']; $Discount = $row['Discount']; $totalPayment = $row['TOTALPAYMENT']; $balance = $amount - (($amount/100)*$Discount); ?> </tbody><tfoot> <tr><td></td></tr> </tfoot> </table> <table> <tbody> <tr> <td>Total Client Payment:</td> <td><?php echo number_format($totalPayment,2); ?></td> </tr> <tr> <td>Total Balance:</td> <td><?php echo number_format($balance,2); ?></td> </tr> <tr> <td>Total Payment due:</td> <td><?php echo ""; ?></td> </tr></tbody></table> <?php } } ?> I forgot to note that the TOTAL BALANCE calculation is not correct. Any help would be appreciated. Dear All, I am trying to fetch the sum of a column for current date and subtract a value from the sum for currently selected record. The query i build works fine in MySql but when the same query i placed in php no result it's blank. Below is the query.
<?php //Calculation for no of paxs. $query2=mysqli_query($con,"SELECT SUM(noopaxs-gattl) FROM tblsupvisitor where date(EnterDate) = CURDATE() || gst = 'INH' || gst = 'IN' GROUP BY confno"); $calc_no_paxs_for_today=mysqli_fetch_row($query2); $gattl=$calc_no_paxs_for_today['gattl']; ?>
and her is the assignment to the textbox.
<div class="row form-group"> <div class="col col-md-3"> <label for="textarea-input" style="color: purple" class=" form-control-label"><strong>Total No. Of Adults</strong></label> </div> <div class="col-12 col-md-9"> <input name="gattl" id="gattl" rows="9" class="form-control" required="" value="<?php echo $gattl;?>"> </div> </div>
Any help in this regard will be highly appreciated.
Kind Regards, Naveed. This is a bit of a puzzle. Look at the sum and result below: Code: [Select] $markTotal += ($session['Mark'] / 100 * $session['SessionWeight']); Result on Browser Module: CHI2550 - Modern Database Applications 41.2 (this is $markTotal) Session: AAB 72(this is $session['Mark']) 20% (this is $session['SessionWeight']) (The percentage signs are just add ons) Session: AAE 67(this is $session['Mark']) 40% (this is $session['SessionWeight']) As you can see the answer to the calculation above is right, the answer is 41 .2 as it adds up the two session marks, divide by 100 and then times it by the total amount of the percentage. But I want to include a total mark where except it is out of the total session percentage (60% for above example), it is out of a 100% but I can not work as simple as that as in above example one session is worth more than other. I have worked out that the answer for the total mark of the above example out of 100% should be 69, but how do I achieve this in my calculation. Thank you and any help is much appreciated So how Hi, I have a calculation issue in my php. Below is my code: $ Code: [Select] moduletotal = 0; $modulecount = 0; $sessionweight = 0; while ($row = mysql_fetch_array($result)){ $moduletotal += $row['Mark']; $modulemark = (int)($moduletotal); // Here and above is the calculation which is simply adding the total number of marks // Below is the code that displays my results. The variable of the calculation is shown at the end of the last if statement (3rd one down) $output = ""; $studentId = false; $courseId = false; $moduleId = false; if($studentId != $row['StudentUsername']) { $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})"; } if($courseId != $row['CourseId']) { $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <br><strong>Year:</strong> {$row['Year']}</p>"; } if($moduleId != $row['ModuleId']) { $moduleId = $row['ModuleId']; $output .= "<p><br><strong>Module:</strong> {$row['ModuleId']} - {$row['ModuleName']} {$row['Credits']} $modulemark</p>"; } $output .= "<p><strong>Session:</strong> {$row['SessionId']} {$row['Mark']} {$row['Grade']} {$row['SessionWeight']}%</p>"; } echo $output; ?>The Results look like this at the moment (The answer the calculation is next to each Module): Student: Mayur Patel (u0867587) Course: INFO101 - Bsc Information Communication Technology Year: 3 Module: CHI2550 - Modern Database Applications 20 72 (72 is the answer to the calculation for the first module but this is incorrect at it should also add the 67 and thus become 139) Session: AAB 72 A 20% Session: AAE 67 B 40% Module: CHI2513 - Systems Strategy 20 200 (200 is the answer to the calculation for this module but this is incorrect it should be only 61. But what it has done is that it has added the 72 and 67 from the first module and added it with the 61 in this module) Session: AAD 61 B 50% SO WHAT MY QUESTION IS HOW CAN I GET THE CALCULATION SO THAT IT ONLY ADDS UP EACH SESSION MARKS THAT BELONGS TO A MODULE ONLY? IN THE EXAMPLE ABOVE IT SHOULD ONLY ADD THE MARKS FOR SESSION AAB AND AAE IN THE MODERN DATABASE APPLICATIONS MODULE AND THEN WHEN IT GETS TO THE NEXT MODULE WHICH IS SYSTEMS STRATEGY, THE MARKS FOR THAT MODULE SHOULD START AGAIN AND ADD ON THE MARKS FOR THE SESSION AAD IN THAT MODULE. HOPEFULLY YOU UNDERSTAND AND THANK YOU Below is the query if you want to look at it: Code: [Select] $query = " SELECT c.CourseName, st.CourseId, st.Year, st.StudentUsername, st.StudentForename, st.StudentSurname, s.ModuleId, s.SessionId, s.SessionWeight, gr.Mark, gr.Grade m.ModuleName, m.Credits, FROM Course c INNER JOIN Student st ON c.CourseId = st.CourseId JOIN Grade_Report gr ON st.StudentId = gr.StudentId JOIN Session s ON gr.SessionId = s.SessionId JOIN Module m ON s.ModuleId = m.ModuleId WHERE (st.StudentUsername = '".mysql_real_escape_string($studentid)."') ORDER BY c.CourseName, st.StudentUsername, m.ModuleName, s.SessionId "; Hi, I have an itinerary form at http://www.happydaysremovals.com/estimate.html Customers fill this in, and it uses phpmailer-fe to email the results to myself. I use a HTML .tpl file so I can make the output email look as I want. All that is fine, but I would like a volume calculator. Next to each item on the form, the customer enters the amount of that item, usually 1 or 2. If it was say a setee, I want to define that a setee = 30 cubic feet, for example. Then I want the calculator to calculate the total cubic footage for all the variables, and include it in the html email. I know with javascript this can be done, but I was hoping for a PHP result and for it to somehow work in with phpmailer-fe, for example: </style> <script language="JavaScript"> function write_this() { var setteelarge; var setteemedium; var setteesmall; var setteelarge2; var setteemedium2; var setteesmall2; var setteelargeresult; var setteemediumresult; var setteesmallresult; var total; setteelarge = document.form1.LargeSettee.value; setteemedium = document.form1.MediumSettee.value; setteesmall = document.form1.SmallSettee.value; setteelarge2 = 45 setteemedium2 = 31 setteesmall2 = 22 setteelargeresult = (setteelarge * setteelarge2); setteemediumresult = (setteemedium * setteemedium2); setteesmallresult = (setteesmall * setteesmall2); total = (setteelargeresult+setteemediumresult+setteesmallresult) document.form1.Total_Cubic_Feet.value = total } </script> Basically, I want to be able to include the cubic feet total value to also be emailed to me in the HTML email, but preferably all in PHP. At the moment, I get everyones itinerary, but want to be automatically be able to work out the cubic footage. Thanks The time dosen't calculate correctly!!! When the local time is 3:15pm on16th Nov 2010 - "Time Expired" dosen't show. When I echo $drawT-time() it shows 60000 odd. What's wrong here? $drawH = 15; $drawM = 15; $drawM = 11; $drawD = 16; $drawY = 2010; $cutoffT = 4; $drawT = mktime($drawH, $drawM, 0, $drawM, $drawD, $drawY); date_default_timezone_set("Australia/Melbourne"); if($drawT-time() < $cutoffT*60) { echo "Time Expired."; } Please help me calculate this according to the "if" condition. $scoreM['newtag'] + $scoreU['newPrice'] $SomeVar = 'currentPrice'; $queryU = "SELECT * FROM db1 WHERE bookprice = '".$SomeVar."'"; $resultU = mysql_query($queryU); $scoreU = mysql_fetch_assoc($resultU); echo $scoreU['newPrice']; echo $scoreU['weeklyScr']; echo $scoreU['priceX']; //// $WinVar = 'additionalAmount'; $query = "SELECT * FROM db2 WHERE booklist = '".$WinVar."'"; $result = mysql_query($query); $scoreM = mysql_fetch_assoc($result); echo $scoreM['newtag']; echo $scoreM['priceY']; if($scoreU['priceX']== $scoreM['priceY']) { $udatedValue = ($scoreM['newtag'] - $scoreU['newPrice']); echo(udatedValue); } else{ $udatedValue = ($scoreM['newtag'] + $scoreU['newPrice']); echo(udatedValue); } Hi. I am writing software to choose employees for drug testing. Originally it was choosing 5 per day, Mon-Thu. No problem there, that's easy. Now, they want to ensure everyone gets tested each calendar year. So now I need the program to look at the date and calculate the days between now and 12/31 then divide the people that haven't been tested by days to get number per day that need testing so it gets all done by the end of the year.
The snag I hit is how to calculate it. I can easily get days to 12/31, but I need to drop the Fridays, Saturdays and Sundays of each week. That has me a little perplexed. Is there a way to make that kind of calculation? Thanks!
Good day! I've been stumbled into a situation wherein the user have predefined time (this will be the expiration time) and the system will have to compare the user time based on server time. I've done the job in getting the time with timezone inclusion using javascript var userDate = new Date(); // output : Tue Dec 06 2011 16:18:23 GMT+0800 (PHT) I passed that javascript value using ajax to the server, the problem I encounter is the compare the current server date with the userDate. Any solution? Thanks in advance. Hi I don't understand what I'm doing wrong, I want to subtract 6 months from my date, but I get 1969/07 as an answer? Code: [Select] <?php $date = date('Y/m'); echo $date; echo "<br/>"; $date1 = date ("Y/m", strtotime("-6 month", strtotime($date))); echo $date1; ?> I have a table of members (18) with games played, won, drawn, lost and would like to know if its possible to have the points and percentage update automatically, example- ID Member Grade Played Won Drawn Lost Points % 1 Player name 142 13 1 10 2 6 46.15 My web-page is currently static and i go to http://math.about.com/library/weekly/aa061502a.htm fill in the games played and points and it gives the percentage, i have very little knowledge of php and by some miracle have managed to create a database using wamp and have extracted the data onto local host web page, my code as follows please let me know if i have any errors- Code: [Select] <?php require "connect.inc.php"; echo "<table width='700'> <tr> <th></th> <th>Member</th> <th>Grade</th> <th>Played</th> <th>Won</th> <th>Drawn</th> <th>Lost</th> <th>Points</th> <th>&#37;</th> </tr>"; $result = mysql_query("SELECT * FROM members"); while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['id'] . "</td>"; echo "<td>" . $row['member'] . "</td>"; echo "<td>" . $row['grade'] . "</td>"; echo "<td>" . $row['played'] . "</td>"; echo "<td>" . $row['won'] . "</td>"; echo "<td>" . $row['drawn'] . "</td>"; echo "<td>" . $row['lost'] . "</td>"; echo "<td>" . $row['points'] . "</td>"; echo "<td>" . $row['percentage'] . "</td>"; echo "</tr>"; } echo "</table>"; ?> Please tell me how i can have the points and percentage update automatically and keep in mind im a novice with php. Best wishes, John Hi guys, $T_Start_Date = "2011-10-23"; $P_Days = "30"; I tried this Its working: $T_End_Date = date('Y-m-d', strtotime("+$P_Days days"); but why am not getting this: $T_End_Date = date($T_Start_Date, strtotime("+$P_Days days")); thanks
Hi, When I use this: echo number_format(150 + 20.95 + .5, 2); ... I get 170.95. Yet on my calculator, 150 + 20.95 + .5 gives me 171.45. Why is that? Hi, I have an attendance system that calculates time in and time out for each day. I have a db field with time datatype that stores the total time for one day, say for example for today the total is 7:15:00 (7 hours and fifteen minutes). i am making a report to show all attendance records for a week. I need to show total of hours a week which is around 35-40 hours so how can this be done? screenshot of what i have. Edited March 15, 2020 by ramiwahdan typo error Hi i was wondering if its possible to not display negative values or maybe there some other way to do this when date is calculated. in this case i have days, and the result brings "- 123" or "- 56" i just want it to show anything that's not negative. thanks. Code: [Select] $start_ts = strtotime($row['Applied']); // when process started $end_ts = strtotime($row['Approval']); // when process finished $Approval = floor(($end_ts - $start_ts) / (60*60*24)); // days difference from start to finish hi, I have some code that deals with sending out reminders for appointments due the following day. So if today is the 21/3 then only reminders for appointments due on the 22/3 should be sent. Currently this isn't happening... If reminders are sent on 21/3 at 9.50 am, my code adds 24 hours to this datetime and sends reminders due for all appointments that fall bewteen 21/3 9.50am and 22/3 9.49 am. What I want to do is simply send all reminders for appointments that are on the 22/3 exclusive of time. I'm not sure how do this in php, which uses the unix datetime format to mildy complicate issues anhy help or solutions would be massive, thanks.how to Code: [Select] $days = time() + (1 * (60 * 60 * 24)); $apts = $db->fetch_all('status = 1 AND time > ? AND time < ?', array(time(), $days)); Hi, I need field calculation formula. I have following four fields. I want to calculate End Date based on values in Tracking Unit, Total Units and Start Date. Tracking Unit (Daily,Weekly,Monthly,Quarterly) for example Tracking Unit => Monthly Total Units => 12 Start Date => 2011-01-01 End Date => 2011-12-01 another example Tracking Unit => Weekly Total Units => 12 Start Date => 2011-01-01 End Date => ? I want to calculate End Date either in PHP or Javascript. Any idea? |