I am using the following code to build a Google Chart, to pull in all of entries in a MySQL table corresponding to the Week Numbers in a year. At the moment the Week Numbers st
For it to work in your code, you should be able to change the query to:
"SELECT Sum(Due) FROM patient_sessions WHERE Type='Session' AND Week(Date,1)=$i"
However, I think I could go one step further and use the GROUP BY to make one sql call, and then iterate over the results;
"SELECT Week(Date,1), SUM(DUE) FROM patient_sessions WHERE Type='Session' GROUP BY Week(Date,1)"
Alternatively, you might need to use WEEK(Date,2) depending on how you want to handle weeks that span between years.