I want to calculate the financial year using php to get data from mysql tables.
The requirement is to calculate student score in every financial year (31 march to 1 April). Is it possible to make any function that calculates these dates by itself every year?
My table for students test score is storing test dates (2-sep-2012) and it has old record also for same student of (2-sep-2011) this year. I want out put of current year only. until now I can't get this, here is my code:-
$result1 = mysql_query(
"SELECT SUM(score), SUM(score_from)
FROM school_test_report, school_students
WHERE (school_test_report.student_id = school_students.student_id and
school_test_report.class=school_students.class)
AND school_test_report.student_id='$id'
AND school_test_report.subject = 'maths'
/* something here to get dates school_test_report.test_date is between 31 march to 1 April */"
)
or die(mysql_error());
$row = mysql_fetch_assoc($result1);
echo $row['SUM(score)'].'/'. $row['SUM(score_from)'];
Its giving me over all result not for one financial year.