Re: calculations with php
Posted: Fri Jan 16, 2009 10:50 am
i have managed to get differring results using the date1 and date2 parameters that i needed using this code:
what i would like to know is if i can have named (specific) dates. this would mean that i can have the results for any given month or months
Code: Select all
$usabilityQuery1 = "SELECT avg(usability) as avgUsability1 FROM usabilityresults WHERE dateSubmitted between DATE_SUB(now(), interval 1 DAY) and now()";
$usabilityresult1=mysql_query($usabilityQuery1);
$usabilityRow1 = mysql_fetch_array($usabilityresult1);
$usabilityQuery2 = "SELECT avg(usability) as avgUsability2 FROM usabilityresults WHERE dateSubmitted between DATE_SUB(now(), interval 2 DAY) and now()";
$usabilityresult2=mysql_query($usabilityQuery2);
$usabilityRow2 = mysql_fetch_array($usabilityresult2);