0

im having trouble on making the mysql code on GROUP_CONCAT to html code. my main problem is the <br> or \n on mysql to make a next line to the html.

my phpmyadmin mysql query looks like:

SELECT master_list.firstname, master_list.middlename, master_list.lastname, section.Section_name, section.school_year, GROUP_CONCAT(subjects.subject_name,' ',
subjects.firstgrading,' ', subjects.secondgrading,' ',subjects.thirdgrading,' ',subjects.fourthgrading,' ',subjects.average_grade SEPARATOR '\n')
FROM master_list, section, subjects

and here are the results:

    firstname | middlename | lastname | section_name | school_year | GROUP_CONCAT
    vince     |Monarca     | carreon  | grade 10     | 2016 - 2017 | English 4 80 84 83 82 82
                                                                     Filipino 4 90 91 88 89 90

my html query code:

$raw_results = mysql_query("SELECT firstname, middlename, lastname 
            ,section_name, school_year
            ,subject_name, firstgrading, secondgrading, thirdgrading, fourthgrading, average_grade
            FROM master_list,section,subjects
            WHERE (student_id LIKE '".$query."')") or die(mysql_error());

i really need help on making the mysql result the same on my html/php codes. i have been trying different ways for hours now. any help would be greatly appreciated.

Nonoy Riz
  • 21
  • 3
  • If it was me, I'd get rid of all the aggregation, and handle any remaining display issues in a simple PHP loop. (Although that alone wouldn't avert the needless death of more tiny kittens - qf http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – Strawberry Sep 11 '16 at 08:52
  • Actually, the root problem here is one of poor design. So the place to start is normalisation. – Strawberry Sep 11 '16 at 08:53

0 Answers0