Projecten
query($sql); if ($result->num_rows > 0) { // Output data of each row while($row = $result->fetch_assoc()) { $uuid = $row["uuid"]; $image = getPhoto($uuid); echo "" . htmlspecialchars($row["name"]) . "
"; echo "" . htmlspecialchars($row["description"]) . "
"; echo ""; echo ""; } } else { echo "
Geen projecten gevonden.
"; } $conn->close(); function getPhoto($uuid) { $sql = "SELECT * FROM tb_projectimages WHERE project_uuid = ?"; // Prepared statement om SQL-injectie te voorkomen global $conn; $stmt = $conn->prepare($sql); $stmt->bind_param("s", $uuid); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { return "
";
}
$stmt->close();
$imagePath = "images/projects/" . $uuid . ".png";
if (file_exists($imagePath)) {
return "
";
}
}
?>