zwema Posted December 25, 2012 Share Posted December 25, 2012 Hello all, I’m new to PHP-MySQL and I have what may appear to be an elementary question. But please help: I have 3 MySQL columns 'due_date', 'client' and 'client_number_of_jobs'. please refer to image on this page Using PHP, I would like to chart the number of times a due_date appears in the table, the other columns don’t really matter. Please note that I would also like to display dates on which there are no jobs for example, 13th December 2012, 17th December 2012 The view should start from “today’s date” and end with “today’s date + 21 days” (jobs over the next 3 weeks) I’ll appreciate your help, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/272349-display-information-from-2-mysql-columns/ Share on other sites More sharing options...
Barand Posted December 25, 2012 Share Posted December 25, 2012 (edited) you need a query like this SELECT due_date, COUNT(*) as total FROM table WHERE due_date BETWEEN CURDATE() AND CURDATE() + INTERVAL 21 DAY GROUP BY due_date Edited December 25, 2012 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/272349-display-information-from-2-mysql-columns/#findComment-1401207 Share on other sites More sharing options...
zwema Posted December 26, 2012 Author Share Posted December 26, 2012 Barand, thanks. Now i have selected the data using that statement, how do i go about presenting it as a chart of number of jobs per due_date? Quote Link to comment https://forums.phpfreaks.com/topic/272349-display-information-from-2-mysql-columns/#findComment-1401275 Share on other sites More sharing options...
Barand Posted December 26, 2012 Share Posted December 26, 2012 There is a link to baaChart in my signature. That should help. Quote Link to comment https://forums.phpfreaks.com/topic/272349-display-information-from-2-mysql-columns/#findComment-1401277 Share on other sites More sharing options...
zwema Posted December 26, 2012 Author Share Posted December 26, 2012 brilliant! thank you. Quote Link to comment https://forums.phpfreaks.com/topic/272349-display-information-from-2-mysql-columns/#findComment-1401278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.