-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchFormExplore.php
More file actions
30 lines (26 loc) · 858 Bytes
/
fetchFormExplore.php
File metadata and controls
30 lines (26 loc) · 858 Bytes
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
<?php
$con = mysqli_connect('localhost','root','idc1234','delta');
$orderBy = 'total_submissions';
$stmt = $con->prepare("SELECT * FROM form_list WHERE status = '1' ORDER BY total_submissions DESC");
$output = ' <tr>
<th>TITLE</th>
<th>TOTAL SUBMISSIONS</th>
<th>DATE OF CREATION</th>
</tr>';
if(isset($_POST['option'])){
if($_POST['option'] === '0'){
$stmt = $con->prepare("SELECT * FROM form_list WHERE status = '1' ORDER BY date_created DESC");
}
$stmt->execute();
$result = $stmt->get_result();
if(mysqli_num_rows($result) > 0){
while($row = $result->fetch_assoc()){
$output .= '<tr><td>'.$row['form_title'].'</td><td>'.$row['total_submissions'].'</td><td>'.date('Y-m-d',strtotime($row['date_created'])).'</td></tr>';
}
}
else {
$output .= "<div>No Forms are open now";
}
echo $output;
}
?>