-
Notifications
You must be signed in to change notification settings - Fork 0
/
allcampaign.php
101 lines (84 loc) · 2.23 KB
/
allcampaign.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
require_once 'includes/conn.inc.php';
// Fetch all campaigns from the database
$sql = "SELECT * FROM donees WHERE status = 'approved'";
$result = mysqli_query($conn, $sql);
if (!$result) {
die("Error: " . mysqli_error($conn)); // Add error handling
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/all.css">
<title>All Campaigns</title>
<style>
.no-underline{
text-decoration: none;
color: black;
}
.no-underline:hover{
text-decoration: none;
}
.campaigns {
display: flex;
flex-direction: column;
gap: 20px; /* Add space between grid items */
}
.campaign {
border: 1px solid black;
padding: 15px;
text-align: center;
position: relative;
width: 1000px;
height : auto ;
left: 100px;
}
.campaign h2 {
margin-top: 0;
}
.campaign img {
max-width: 100%;
height: auto;
margin-bottom: 10px;
}
</style>
</head>
<body>
<?php
include_once "includes/header.php";
?>
<h1 style="text-align: center;">All Campaigns</h1>
<div class="campaigns" >
<?php
// Check if any campaigns are found
if (mysqli_num_rows($result) > 0) {
// Loop through each campaign and display information
while ($row = mysqli_fetch_assoc($result) ) {
$goal = $row['goal'];
$title = $row['tittle'];
$category = $row['category'];
$course = $row['course'];
$image = $row['image'];
$description = $row['description'];
// Display campaign information
echo '<a href="campaign_details.php?id=' . $row['id'] . '" class="no-underline">
<div class="campaign">
<h2>' . $title . '</h2>
<p><strong>Category:</strong> ' . $category . '</p>
<p><strong>Course:</strong> ' . $course . '</p>
<p><strong>Goal:</strong> $' . $goal . '</p>
<img src="uploads/' . $image . '" alt="Campaign Image" width="150px" height="150px">
<p>' . $description . '</p>
</div>
</a>';
}
} else {
echo '<p>No campaigns found.</p>';
}
// Close database connection
mysqli_close($conn);
?>
</div>
</body>
</html>