0
             <?php
        $host="localhost"; // Host name
        $username="root"; // Mysql username
        $password=""; // Mysql password
            $db_name="relaxinn"; // Database name

        $con=mysqli_connect("$host","$username","$password","$db_name");
        if (mysqli_connect_errno($con)) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

//Get number of rows
$categories = array();
$sql="SELECT * FROM books ";
$result=mysqli_query($con, $sql);
while($row=mysqli_fetch_assoc($result))
{
    $categories[$row['language']][] = $row['code'];

}  
//Start table
echo "<table>";

    // any type of outout you like
        foreach($categories as $key => $category){
 echo "<tr class='altrow' align='left'>";
 echo  "<th>" .$key.'<br/>'. "</th>";
 echo "</tr>";
 foreach($category as $item){ 

    echo "<tr class='altrow' align='left'>";
    echo "<td>" .$item.'<br/>'. "</td>";

    echo "</tr>";
     }

    }?>
2
Contributors
1
Reply
18
Views
1 Year
Discussion Span
Last Post by diafol
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.