Here's an example of how to display MySQL database records in Bootstrap columns.
A Whiter Shade of Pale
Procol Harum (1967)
A Woman in Love
Barbra Streisand (1980)
All That She Wants
Ace of Base (1993)
Procol Harum (1967)
A Woman in Love
Barbra Streisand (1980)
All That She Wants
Ace of Base (1993)
Angie
The Rolling Stones (1973)
Another Day in Paradise
Phil Collins (1989)
Baby One More Time
Britney Spears (1999)
The Rolling Stones (1973)
Another Day in Paradise
Phil Collins (1989)
Baby One More Time
Britney Spears (1999)
Barbie Girl
Aqua (1997)
Believe
Cher (1998)
Bette Davis Eyes
Kim Carnes (1981)
Aqua (1997)
Believe
Cher (1998)
Bette Davis Eyes
Kim Carnes (1981)
HTML
<div class="container">
<div class="row justify-content-between">
<?php
$conn = new mysqli ("server", "user", "password", "database");
mysqli_set_charset ($conn, "utf8");
if ($conn -> connect_error) {
die ("Error: " . $conn->connect_error);
}
$sql = "SELECT * FROM top_100_songs_eu ORDER BY song ASC LIMIT 0, 9";
$result = $conn -> query($sql);
if ($result -> num_rows > 0) {
while ($row = $result -> fetch_assoc()) {
$row_song_title[] = '<strong>' . $row["song"] . '</strong><br />' . $row["artist"] . ' (' . $row["year"] . ')<br /><br />';
$songs_list = array_chunk($row_song_title, ceil(count($row_song_title) / 3));
}
foreach ($songs_list as $songs_column) {
echo '<div class="col-md-4">';
foreach ($songs_column as $song_output) {
echo $song_output;
}
echo "</div>";
}
}
else {
echo "No records found";
}
$conn -> close();
?>
</div>
</div>
Comma after each value, except the last one
Display records
Display records in a Bootstrap Table
Display records in columns
Display records with Bootstrap pagination
Display records with CSS styles
Escape special characters in a string
Highlight the search term in results
Replace unicode characters by utf-8
Search autocomplete with Typeahead
Search records by an option
Select rows for the current day and month
Short commands