Hi there, I'm pretty new to PHP and Mysql so could really do with being pointed in the right direction with this problem I have.
I am trying to set up a system induct new members of staff onto their training programme.
First I have created a table 'induction_course_dates' of all the course dates and induction_course_titles of all the different courses.
These are the 2 queries I have made on the database
///////////////////////// Make the course title query ////////////////////////////// $q_courses = "SELECT * FROM induction_course_titles"; $result_courses = mysqli_query($dbc, $q_courses); $row_courses = mysqli_fetch_array($result_courses);
///////////////////////// Make the course date query ////////////////////////////// $q_date = "SELECT * FROM induction_course_dates WHERE DATE(course_date)>='$today' AND course='$courseID' ORDER BY course_date ASC LIMIT 4"; $result_date = mysqli_query($dbc, $q_date); $row_date = mysqli_fetch_array($result_date);
Obviously in the second query '$courseID' does not have a value so won't actually return anything but I don't know how to loop it through all of the induction_course_titles id's.
For example if it the query read...
///////////////////////// Make the course date query ////////////////////////////// $q_date = "SELECT * FROM induction_course_dates WHERE DATE(course_date)>='$today' AND course='2' ORDER BY course_date ASC LIMIT 4"; $result_date = mysqli_query($dbc, $q_date); $row_date = mysqli_fetch_array($result_date);
...then this would return the results I'm looking for but there are 25 different courses.
I want the final output to appear as below
The user will select a date from the next four available