all! I have a bit of a tricky one for you today, I want to use the select DISTINCT statement to both select a row that needs to be distinct but also in the same statement (or the way I a have tried?) a row that doesn't/can't be distinct. My desired result is to only have one of each of the classnames. Currently it outputs like this:
English: textbook, folder, laptop
English: textbook
Media:   textbook, folder
English: textbook, folder
English: textbook, folder
Art:     textbook
And this is how I want it to output:
English: textbook, folder, laptop
Media:   textbook, folder
Art:     textbook
This is the layout of the database:
|ID|classname|Book  
|49|English  |textbook, folder, laptop
|50|English  |textbook  
|53|Media    |textbook, folder 
|54|English  |textbook, folder 
|55|Art      |folder 
I'm obviously VERY new to php so any help would be appreciated!
This is my approach so far:
$sql = "SELECT DISTINCT classname FROM classes ORDER BY Due;";
$result1 = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result1);
if ($resultCheck > 0){
    while ($row = mysqli_fetch_assoc($result1)){
        $classname = $row["classname"];
        if ($classname == "English"){
            $newName = $classname;
            $sql = "SELECT Book FROM classes WHERE Book='$newName';";
            $result1 = mysqli_query($conn, $sql);
            $resultCheck = mysqli_num_rows($result1);
            if ($resultCheck > 0){
                while ($row = mysqli_fetch_assoc($result1)){
                    $materials = $row["Book"]; 
                    echo "<div class='subname'>$newName:";
                    echo "<div class='wow'>$materials</div>";
                    echo "</div><br>";
                }
            }
        }
    }
}
 
     
    