-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
104 lines (93 loc) · 4.67 KB
/
index.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
102
103
104
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.rtl.min.css"
integrity="sha384-T5m5WERuXcjgzF8DAb7tRkByEZQGcpraRTinjpywg37AO96WoYN9+hrhDVoM6CaT" crossorigin="anonymous">
<style>
#ques {
min-height: 433px;
}
</style>
<title>Code Talk</title>
</head>
<body>
<?php include 'Partials/_dbconnect.php'; ?>
<?php include 'Partials/_headers.php'; ?>
<!-- slider starts here -->
<div id="carouselExampleIndicators" class="carousel slide">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="0" class="active"
aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="1"
aria-label="Slide 2"></button>
<button type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide-to="2"
aria-label="Slide 3"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://source.unsplash.com/2400x700/?apple,code" class="d-block w-100">
</div>
<div class="carousel-item">
<img src="https://source.unsplash.com/2400x700/?microsoft,programmer" class="d-block w-100" alt="...">
</div>
<div class="carousel-item">
<img src="https://source.unsplash.com/2400x700/?coding,hacking" class="d-block w-100" alt="...">
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators"
data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators"
data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<!-- categories container starts here -->
<div class="container my-4" id=ques>
<h2 class="text-center my-4">Code Talk - Browse Categories</h2>
<div class="row my-4">
<!-- fetch all the categories -->
<!-- using a for loop to iterate through categories -->
<?php
$sql = "SELECT * FROM `categories` ";
$result = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_assoc($result))
{
// $row['category_id'];
$id = $row['category_id'];
$cat = $row['category_name'];
$desc = $row['category_description'];
echo '<div class="col-md-4 my-2">
<div class="card " style="width: 18rem;">
<img src="https://source.unsplash.com/500x400/?'.$cat.',coding" class="card-img-top">
<div class="card-body ">
<h5 class="card-title"><a class = "text-dark" href = "threadlist.php?catid='.$id.'">'.$cat.'</a></h5>
<p class="card-text">'.substr($desc,0,100).'...</p>
<a href="threadlist.php?catid='.$id.'" class="btn btn-success">View Threads</a>
</div>
</div>
</div>';
}
?>
</div>
</div>
<?php include 'Partials/_footer.php'; ?>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe" crossorigin="anonymous">
</script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-zYPOMqeu1DAVkHiLqWBUTcbYfZ8osu1Nd6Z89ify25QV9guujx43ITvfi12/QExE" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-Y4oOpwW3duJdCWv5ly8SCFYWqFDsfob/3GkgExXKV4idmbt98QcxXYs9UoXAB7BZ" crossorigin="anonymous"></script>
-->
</body>
</html>