-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfquery_print.php
54 lines (43 loc) · 1.28 KB
/
fquery_print.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
<?php
include './include/check_login.php';
include './include/connection.php';
include_once 'include/admin-main.php';
include('access_control.php');
$from_date = isset($_POST['from_date']) ? $_POST['from_date'] : '';
$to_date = isset($_POST['to_date']) ? $_POST['to_date'] : '';
$query = "SELECT * FROM contact WHERE product = 'Football'";
if (!empty($from_date) && !empty($to_date)) {
$query .= " AND sub_time BETWEEN '$from_date' AND '$to_date'";
}
$result = mysqli_query($con, $query);
// Include your HTML structure for printing here
echo '<h3>Football Contact Query</h3>';
echo '<table border="1" cellpadding="10" cellspacing="0">
<tr>
<th>Sn.</th>
<th>Product Code</th>
<th>Name</th>
<th>Mobile</th>
<th>Email</th>
<th>City</th>
<th>State</th>
</tr>';
$sn = 1;
while($data = mysqli_fetch_array($result)) {
echo "<tr>
<td>{$sn}.</td>
<td>{$data['pcode']}</td>
<td>{$data['name']}</td>
<td>{$data['mobile']}</td>
<td>{$data['email']}</td>
<td>{$data['city']}</td>
<td>{$data['state']}</td>
</tr>";
$sn++;
}
echo '</table>';
// Include print script to trigger the browser print dialog
echo '<script type="text/javascript">
window.print();
</script>';
?>