0% found this document useful (0 votes)
18 views3 pages

Rms Explanations

Download as txt, pdf, or txt
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 3

enum('Enable','Disable') means that the column can only take one of these specified

values: ‘Enable’ or ‘Disable’.


COLLATE utf8_unicode_ci
Sets the collation for the column.
Collation determines how data is sorted and compared in a database.
utf8_unicode_ci is a Unicode-based collation that uses UTF-8 encoding.
COLLATE utf8_unicode_ci is used to ensure that the username column is case-
insensitive. This means that if you try to insert a new user whose username only
differs in case from an existing user, MySQL will throw an error.
Now, let’s say you want to insert some data into this table:

INSERT INTO Users (username, password) VALUES ('JohnDoe', 'password123');


INSERT INTO Users (username, password) VALUES ('johndoe', 'password456');
The second INSERT statement will fail because ‘JohnDoe’ and ‘johndoe’ are
considered the same due to the case-insensitive collation.

Script files/server side scripts


(In a typical web application, when a user makes a request (like clicking a button
to add a new item), the request is sent to the appropriate controller file (like
items.php). This file then uses the relevant class (like Item.php) to perform the
requested operation (like adding a new item to the database))

index.php: Home page, displays an overview of the restaurant management


system/login screen.

category.php: Responsible for managing food categories in the system. It includes


functionality for adding, editing, and deleting food categories.

items.php: Manages the individual food items and addig new food items, edit
existing ones, or deleting them. Each item is associated with a category.

tables.php: Manages the tables in the restaurant, add, edit, or delete them.

orders.php: Manages customer orders. Includes functionality for creating new


orders, updating orders, and marking orders as completed.

taxes.php: Manages the tax rates that apply to orders.

User.php, Category.php, Item.php, Tables.php, Order.php:


(PHP classes are basically blueprints for creating objects. PHP classes basically
define a specific class that encapsualtes all data and behaivour associated with
that class in an application.)

PHP classes that contain methods for each type of database operation (listing,
adding, editing, deleting) related to their respective entities.

User.php: This class contains methods related to the restaurant_user table in the
database. It includes methods for creating a new user (createUser), retrieving user
information (getUser),etc.

Category.php: This class manages the restaurant_category table. It includes methods


for adding a new category (createCategory), getting category information
(getCategory), etc.
Item.php: This class interacts with the restaurant_items table. It includes methods
for adding a new item (createItem), retrieving item information (getItem), etc.

Tables.php: This class manages the restaurant_table table. It has methods for
adding a new table (createTable), getting table information (getTable), etc.

Order.php: This class interacts with the restaurant_order and restaurant_order_item


tables. It might include methods for creating a new order (createOrder), retrieving
order information (getOrder), etc.

Each method in these classes contain the necessary MySQL queries to perform the
corresponding database operations.
Example: createUser method contain an INSERT INTO query to add a new user to the
restaurant_user table.

Methods used in the PHP classes

listItems() / listOrder(): These methods are responsible for fetching a list of


items or orders from the database. They prepare a SQL query, execute it, and format
the results for use.

createItem() / createOrder(): These methods handle the creation of new items or


orders. They would take the necessary data as parameters, validate the data,
prepare an INSERT INTO SQL query, and execute it.

getItem() / getOrder(): These methods are used to fetch the details of a specific
item or order. They would take an ID as a parameter, prepare a SELECT SQL query,
execute it, and return the result.

updateItem() / updateOrder(): These methods handle the updating of existing items


or orders. They would take the necessary data as parameters, validate the data,
prepare an UPDATE SQL query, and execute it.

deleteItem() / deleteOrder(): These methods are used to delete an item or order.


They would take an ID as a parameter, prepare a DELETE SQL query, and execute it.

Prior to running the website, databases must be inputted.

Install a Database Server: MySQL is commonly used with PHP. You can install it
standalone or as part of a package like XAMPP, WAMP, or MAMP1.

Create Databases: Once your database server is installed and running, you can
create your databases.

Create Tables: After your databases are created, you can create tables within them.

Insert Data: With your tables created, you can now insert data into them.

Configure Database Connection in PHP: In your PHP scripts, you’ll need to configure
the connection to your database server. This typically involves specifying the
server name (usually localhost), the username and password for the database server,
and the name of the database you want to connect to.
AJAX allows web pages to be updated asynchronously by exchanging data with a web
server behind the scenes. This means it’s possible to update parts of a web page
without reloading the whole page.

Here’s how AJAX works:

An event occurs in a web page (the page is loaded, a button is clicked).


An XMLHttpRequest object is created by JavaScript.
The XMLHttpRequest object sends a request to a web server.
The server processes the request.
The server sends a response back to the web page.
The response is read by JavaScript.
Proper action (like page update) is performed by JavaScript.

You might also like