$SQL_report = "select distinct student_id, student_name, student_address, student_gpa, college from SCHOOL where MINOR = 'CS' ORDER BY student_id"; $sth->execute; while (@row = $sth_report->fetchrow_array) { $student_id = (defined $row[0]) ? $row[0] : ''; $student_name = (defined $row[1]) ? $row[1] : ''; $student_address = (defined $row[2]) ? $row[2] : ''; $student_gpa = (defined $row[3]) ? $row[3] : ''; $college = (defined $row[4]) ? $row[4] : ''; ## Make our html look better if no data. $student_id = " " if ($student_id eq ""); $student_name = " " if ($student_name eq ""); $student_major = " " if ($student_address eq ""); $student_gpa = " " if ($student_gpa eq ""); $college = " " if ($college eq ""); } # End of while