0% found this document useful (0 votes)
7 views2 pages

Session Start

This document is a PHP script for an order management system for a restaurant named KAYAHAO. It includes session management for admin login, a search feature for retrieving food order records based on the order date, and displays the results in a table format. Additionally, it provides options to print the report or return to the main menu.

Uploaded by

joedoethedough
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Session Start

This document is a PHP script for an order management system for a restaurant named KAYAHAO. It includes session management for admin login, a search feature for retrieving food order records based on the order date, and displays the results in a table format. Additionally, it provides options to print the report or return to the main menu.

Uploaded by

joedoethedough
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1 <!

-- Sistem Pengurusan Pesanan -->


2 <!-- by: Chow Jia Yue -->
3 <!-- File laporan.php -->
4
5 <?php
6 // Fail sambungan ke pangkalan data
7 include 'sambungdb.php';
8
9 // Mulakan sesi
10 session_start();
11
12 // Sekatan pengguna - semak jika tiada pentadbir yang log masuk
13 if (!isset($_SESSION['pentadbir'])) {
14 // Jika tiada pentadbir yang log masuk, arahkan ke log masuk pentadbir
15 header('Location: logmasukadmin.php');
16 exit();
17 }
18 ?>
19
20 <!DOCTYPE html>
21 <html lang="en" dir="ltr">
22 <head>
23 <meta charset="utf-8">
24 <title>KAYAHAO</title>
25 <!-- Sambungan fail CSS -->
26 <link rel="stylesheet" href="css/w3.css">
27 </head>
28 <body>
29 <div class="w3-container w3-center">
30 <?php
31 // Semak jika borang carian telah dihantar
32 if (isset($_POST['cari'])) {
33 // Dapatkan tarikh pesanan dari input pengguna
34 $tarikhpesanan = mysqli_real_escape_string($db, $_POST['tarikhpesanan']);
35
36 // Dapatkan data pesanan berdasarkan tarikh
37 $query = "SELECT pesanan.*, makanan.*
38 FROM pesanan
39 INNER JOIN makanan ON pesanan.idmakanan = makanan.idmakanan
40 WHERE pesanan.tarikhpesanan = '$tarikhpesanan'";
41 $result = mysqli_query($db, $query);
42
43 // Paparkan rekod pesanan
44 echo "<br><br>";
45 echo "<h4>KAYAHAO Food Order Records</h4>";
46
47 // Semak jika terdapat hasil carian
48 if (mysqli_num_rows($result) > 0) {
49 echo "<h5>Record on date: ".date('d-M-Y', strtotime($tarikhpesanan)).
"</h5><br>";
50 echo '<table class="w3-table w3-border w3-centered" border="1">
51 <tr>
52 <th>No</th>
53 <th>Date of Order</th>
54 <th>Food List</th>
55 <th>Quantity</th>
56 </tr>';
57 // Paparkan setiap rekod pesanan
58 $no = 1;
59 while ($row = mysqli_fetch_assoc($result)) {
60 // Format tarikh yang dipaparkan
61 $formatted_date = date('d-M-Y', strtotime($row['tarikhpesanan']));
62 echo "<tr>
63 <td>".$no++."</td>
64 <td>".$formatted_date."</td>
65 <td>".$row['makanan']."</td>
66 <td>".$row['kuantiti']."</td>
67 </tr>";
68 }
69 echo "</table>";
70 } else {
71 // Paparkan mesej jika tiada rekod pada tarikh yang dicari
72 echo "<h3>There are no orders on this date.</h3>";
73 }
74 }
75 ?>
76 </div>
77 <hr>
78 <center>
79 <!-- Butang untuk mencetak laporan -->
80 <input type="button" class="w3-btn w3-border" value="PRINT" onClick=
"window.print()">
81 <!-- Butang untuk kembali ke laman utama -->
82 <a href="senaraimakanan.php"><button class="w3-btn w3-border">MAIN MENU
</button></a>
83 </center>
84 </body>
85 </html>
86
87 <!-- Bahagian copyright nama restoran -->
88 <div class="w3-container w3-center">
89 <div class="image-and-text">
90 <label class="w3-text-black">
91 <h4 style="font-size: 14px;">Copyright © 1994-2025. All Rights Reserved by
KAYAHAO RESTAURANTS (Registration No. 080223011708)</h4>
92 <label>
93 </div>
94 </div>
95

You might also like