Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php get_header('allcourses');
- global $wpdb;
- $results = $wpdb->get_results(
- "
- SELECT * FROM
- ( Select * FROM allcourses as ac JOIN completedcourses as cc ON ac.id=cc.courseid WHERE 1 ) as T12
- JOIN wp_users as u ON T12.courseid=u.ID WHERE 1
- "
- );
- $tbl = new HTML_TABLE(null, 'display', 1, 0, 4);
- $tbl->addRow();
- $tbl->addCell('Course Name', 'first', 'header');
- $tbl->addCell('Course Value', 'first', 'header');
- //ADD NAME COLUMNS
- foreach ($results as $result)
- {
- $tbl->addCell($result->display_name, 'first', 'header');
- }
- //ADD COURSE ROWS
- $courses = $wpdb->get_results(
- "
- SELECT * FROM allcourses
- ", OBJECT_K
- );
- foreach ( $courses as $course )
- {
- $tbl->addRow();
- $tbl->addCell($course->coursename);
- $tbl->addCell($course->coursevalue);
- //ADD COMPLETED MATRIX
- if ($result->completed){
- while (($result->completed = 'y'))
- $tbl->addCell($result->completed, 'greenbg');
- } else {
- $tbl->addCell($result->completed, 'redbg');
- }
- }
- //DISPLAY TABLE
- echo $tbl->display();
- get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement