How can PHP be used to create a gallery with member profiles that include images?
To create a gallery with member profiles that include images using PHP, you can store the member information in a database and then retrieve and display it on a webpage using PHP. You can use HTML and CSS to format the gallery layout and display the member profiles with their images.
<?php
// Connect to database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "gallery";
$conn = new mysqli($servername, $username, $password, $dbname);
// Retrieve member profiles from database
$sql = "SELECT * FROM members";
$result = $conn->query($sql);
// Display member profiles with images
echo "<div class='gallery'>";
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<div class='profile'>";
echo "<img src='images/" . $row['image'] . "' alt='" . $row['name'] . "'>";
echo "<h3>" . $row['name'] . "</h3>";
echo "<p>" . $row['bio'] . "</p>";
echo "</div>";
}
} else {
echo "No members found.";
}
echo "</div>";
$conn->close();
?>