Web Database Based Inventory System Computer Science Essay

Web database based stock list system is for direction of points, orders, clients and payment. This system helps in Stock direction, payment, and orders. This system allows carry oning payment for clients and for ordered points in the purchase order. The chief aim of this undertaking is about the design of Web-based stock list system.

Bakery feyasse usage traditional paper based stock list system to pull off his information refering client, ordered point, point and payment. There are several jobs with this system such as clip consuming, difficult labor and sometimes lost of information.

The gross revenues growing and order malposition cause a great trade of work for Bakery Feyasse.

The manual system is prone to mistakes ensuing major ailments from clients.

The volume of informations and complexness of analysis to be conducted seems overpowering utilizing their manual system which sometimes raises intuitions of returned consequences which are besides hard to rectify or verify. After careful probe, treatment thorough analysis of bing method, it was agreed that a new effectual system is required to work out Bakery Feyasse jobs.

Get quality help now
Prof. Finch
Prof. Finch
checked Verified writer
star star star star 4.7 (346)

“ This writer never make an mistake for me always deliver long before due date. Am telling you man this writer is absolutely the best. ”

avatar avatar avatar
+84 relevant experts are online
Hire writer

After reexamining the possible design picks, it was decided that MySQL database and PHP book linguistic communication is the best economical tantrum for Bakery Feyasse system in footings of cost, easiness of care, interface design and upgradability utilizing Microsoft Windowss platform. The database would be link to the company 's website via PHP book linguistic communication. The online waiter will enable employee to come in, create, update and delete information online.

1.1. Undertaking aims

1. To make a system that will help the Bakery employee at their different undertaking

2. To research the thoughts involved in the development of a web database stock list site.

This web database stock list system will include the chief map as followers:

Select informations from database

Update information into the database

Delete information from database

And add information into database

The aims of this undertaking are:

Design a relational database

Implement this database

Testing the new system

Measure the system

1.2. Personal aims

My personal aim for this undertaking is to finish the undertaking on clip. I set up a monthly clip tabular array to transport out different undertaking. My enthusiasm is that after finishing this undertaking. I will derive more cognition in computing machine engineering. To enable me to win this undertaking, I used the accomplishments I gain last twelvemonth in MySQL, and SQL. I besides learn how to make a dynamic web site which I did non cognize. I learn new book linguistic communication which is PHP.

1.2. 1. Career aims

Derive my BSc Honours Degree.

Derive more accomplishments in Programming linguistic communication, Calculating scientific discipline and Information Systems Technologies.

1.2. 2. Academic aims

1.Learn programming linguistic communication such as PHP and MySQL

Learn how to utilize PHP book linguistic communication to make a signifier to recover information from web site

Learn how to link MySQL Database with dynamic Website

How to utilize PHP codification to recover information from MySQL database

How to make HTML signifier

How to utilize HTML signifier to recover information from database

How to make database table utilizing MySQL application.

1.3. Undertaking Restrictions

I am wholly witting that my assignment is to make a web database system which is non an easy undertaking and I am besides cognizant of the short I have got to carry through this undertaking. So the clip is my mark. I am believing of coating on clip. Time direction has been considered because ; I besides got one test to fix.

1.4. Gantt chart

1.5. Literature reappraisal

At the start of my undertaking, the researches have been made to garnering information because many activities go into the development of a new system. Understanding system demands, taking database-tier package, planing databases, and constructing the grade are the first stairss in successful web database application development. The following issues have been explored:

Information System Analysis

Database

Database direction systems

Database Server

Database grade

Information Systems Analysis

System Analysis

System Design

This stage demo how the system tally.

Prototype

This stage will enable the employee to understand the functionality of the new system.

Execution

Development of the new system

Testing

The new system is tested in order to verify its maps

Database

A database is a aggregation of related informations. The information stored is rows, which make up a simple clients, points, orders and payment inside informations.

Database Management System

Database Management System enables the users to recover relevant information. It refers to information substructures that compose of relevant information. Database system creates and maintains a database and enables single concern application to pull out the information in order to make study.

Database waiter

Database waiter is a system designed to pull strings the database. Its map is to hive away, recover, and manage information. Its dramas an of import function in web services and provides the n-tier connexion through the Internet users via their web browser.

Database grade

Database grade is the base of a web database application. In a three-tier architecture application, the database grade manages the information. The information direction typically includes storage and retrieval of informations, every bit good as pull offing updates, entree by more than one middle-tier procedure, supplying security, guaranting the unity of informations, and supplying support services such as informations backup.

1.6. Technical reappraisal

The web based database stock list system is making utilizing MySQL application and PHP book linguistic communication. The interface of the system is developed with Hypertext Markup Language ( HTML ) . The system is accessible anyplace that have entree to Internet.

1.6.1. Wed Based Database Systems development tools

Dreamweaver CS3

Dreamweaver CS3 Dreamweaver is a full-featured Web application development tool. Its characteristics non merely help with creative activity and redacting Web pages, but besides with pull offing and keeping the full Web site.

MySQL

MySQL implies the Client /Server architecture, which compose of a waiter procedure and client procedure. A server procedure manages the logical database direction. A sever procedure takes of how the information is stored and organized.

The client procedure would be described as procedure that accesses the waiter in order to hive away, recover, update and change the database scheme.

SQL

SQL ( Structured Query Language ) SQL used to pass on with most databases. You can pull off your database, retrieve information from it, or add informations to it utilizing SQL questions. You build and send an SQL question to the database. The database responds by executing the action defined by the question or, if the database is unable to execute the requested operation, its returns mistake message with information about the job.

Cold Fusion

ColdFusion is a labeled linguistic communication, developed by Macromedia, who is besides the developer of Dreamweaver. A stand-alone Web waiter is besides included as portion of ColdFusion. The stand-alone waiter is all right development, but you should utilize a more powerful Web site.

Asp

ASP Application Server Pages ( ASP ) is Microsoft engineering. It built into IIS ( Internet Information Server ) .When you use ASP engineering ; you have your pick of linguistic communications VBScript or JScript. When you set up your Dreamweaver site, you specify which linguistic communication you want to utilize.

1.6.2. Web Based Database development engineerings

PHP

PHP is a Scripting Language that is interpreted on the web waiter before the web page is sent to a web browser to be displayed. This can be seen in the expanded PHP recursive acronymA PHP-HypertextA Pre-processor.

1.7. Technologies used

1.7.1. PHP and MySQL

PHP and MySQL work in combination, where the database is MySQL and the book linguistic communication is PHP.

How PHP and MySQL work together?

PHP cod information and MySQL shop information. PHP will make retrieve information signifier for the system, but MySQL keep the information in a format PHP.

1.7.2. Why usage PHP and MySQL

PHP and MySQL combine together make easy the development of a dynamic Web page. HTML creates utile web pages with the add-on of PHP and MySQL where you can roll up information.

1. 8. Methodologies Approach

1.8.1. Prototyping

Prototyping is most appropriate methodological analysis for systems that include informations questioning, on-line information updating, and online informations coverage maps. It is used to make appropriate informations entree interfaces for users and to assist place the capablenesss that users wants in the system, such as the options on a bill of fare used by the a system.

1.8.2. Rapid Application Development

Its basic procedure is to acquire systems forces and users together in formal meetings, where they quickly develop systems that provide users with their information demands.

1.8.3. Chosen Methodology

Prototyping Methodology Development pick has been influenced by several factors:

1. Clarify the user demands

2. Acquaintance with the base engineering

3. System complexness

4. Need for the system dependability

5. Time force per unit area

6. Necessitate to see advancement on the clip agenda.

7. And when timelines are short because they best enable me to set the

functionality in the system on the footing of a specific bringing day of the month.

Chapter 2 Analysis

2.1. Bakery Feyasse profile

Bakery Feyasse is a Bakery that was created by Malan Kouao in 1988. The concern started in 1988 with one Bakery and after uninterrupted advancement a 2nd Bakery has been created in 2008. The diagram below show the Bakery Structure

Production director

Sale director

Director

Chairman

Department director

Department director

Department director

Figure: Bakery 's Feyasse construction

2.2. Existing system ( appendices )

The Bakery usage traditional paper based where the employee checks the handiness of the points by questioning the points books, and fills the book by utilizing paper and pen. Furthermore the ordination procedure is made by pen and manus and it is clip devouring to reach the production and it causes slow traveling for the client order and there is hazard of error caused by the employee.

All employee entree the same information, portion the same information.The sales representative look into the handiness of the points by questioning the production section. The production section look into the handiness of the points from the book registry manually. After cognizing the handiness, he fills up the handiness book manually so that the sales representative will cognize which point is available. The history director checks the stock points manually in order to re order the merchandise. The information about the point, the clients, and the providers is kept in a impermanent contact book

2.2. Current Systems

The proposed system is a web based stock list system. The staff of each section can work peacefully at their section. The system allows the staff to make full up the order payment, the order, the point order signifier. The aim of the new system is to make an on-line entree database to hive away all informations refering the Bakery.

The chief activities performed by the system are.

The system provides informations processing and storage.

The system show system functionality.

The system functionality is accessible by snaping selected undertaking.

The system will let the staff to infix information through the selected page.

The system will let the staff to call off information.

The system will let the staff to treat a payment.

The system will let the staff to update information.

2.2.1. Benefits with current system

1. To increase the good administration in point handiness, clients 'details, orders, ordered points and payment informations inputting by utilizing database system.

2. Salespersons will be able to see the list of points produced by the production section anytime

3. Customers inside informations can be kept

4. Order can be kept for future monthly study.

System Requirement Analysis

At this phase I met the user to obtain a elaborate apprehension of Bakery demands. A functional specification, procedure theoretical account, logical theoretical account are defined.

Analysis of the job where Bakery Feyasse attempt to happen a solution with the new system

Specifying the job

Identify the job causes

Stipulating the solution

Identifying the users demands,

And placing new chance for utilizing new engineering

2.2. Users Requirements

Specify the aims of the new system and develop a elaborate description of the map that the new system will execute

The system provides informations processing and storage.

The system show system functionality.

The system functionality is accessible by snaping selected undertaking.

The system allows the staff to infix information through the selected page.

The system allows the staff to call off information.

The system allows the staff to treat a payment.

The system allows the staff to update information.

The director shall be able to make the occupation of the sales representative

2.3. System Specification

The system would enable end-users ( employee ) to make, update information

All information about client, point, order and payment will be stored in a database, which the web database stock list system will expose through different interfaces

Allows the omission and appends information

Facility to question the database

Enables the use of gross revenues activities

Tracking user activities utilizing the system

2.4. Use Cases

Choice order/customer inside informations

Add order/customer inside informations

Delete order/customer inside informations

Update order/customer inside informations

Use instances description ( appendices )

Chapter 3DESIGN

3.1. Architectural Design

Logical design

Physical design

3.1.1. Entities and Properties

Bakery Feyasse will hold a relational database system with the undermentioned entities and properties.

client ( cust_id, cust_name, cust_address, cust_city )

order ( order_id, cust_id* , item_id* , measure, item_price, total_price )

payment ( order_id* , payment_id, payment_type, payment_description, sum )

point ( item_id, item_name, item_price, item_description )

3.1.2. Connecting To Database

In order to publish MySQL informations use statements, we must stipulate a username, a watchword and a database to utilize. This information will hold been provided by your systems adminsistrator. If you are running MySQL yourself, so skip in front to the subdivision onA Making a Database in Part 6A - so come back to this point.

Either manner you should now hold in your ownership a database name, a valid watchword for that database and a watchword. For the intents of these workshops the undermentioned illustration values will be used.

Database Name

vworksDB

Valid MySQL Username

vworks

Password

mypass

In order to log into MySQL right we must go through information to the MySQL client plan when we start it. This is done with the undermentioned bids and sentence structure.

$ mysql -u & lt ; mysql_username & gt ; -p & lt ; watchword & gt ; & lt ; database name & gt ;

3.1.2. Database Design utilizing MySQL

MySQL database is made up of database which contains tabular arraies. A tabular array is a subdivision of the database for hive awaying information.

mysql & gt ; show columns from point ;

+ -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -- +

| Field | Type | Null | Key | Default | Extra |

+ -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -

| item_id | int ( 11 ) | NO | PRI | NULL | auto_increment |

| item_name | varchar ( 50 ) | YES | | NULL | |

| item_price | float ( 6,2 ) | YES | | NULL | |

| item_description | text | YES | | NULL | |

+ -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -- +

mysql & gt ; show columns from order ; a refaire

+ -- -- -- -- -- -- -+ -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -+

| Field | Type | Null | Key | Default | Extra |

+ -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -+

| order_id | int ( 11 ) | YES | | NULL | |

| item_id | varchar ( 50 ) | YES | | NULL | |

| measure | int ( 11 ) | YES | | NULL | |

| item_price | float ( 6,2 ) | YES | | NULL | |

| total_price | float ( 6,2 ) | YES | | NULL | |

+ -- -- -- -- -- -- -+ -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -

mysql & gt ; show columns from client ;

+ -- -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -- +

| Field | Type | Null | Key | Default | Extra |

+ -- -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -- +

| cust_id | int ( 11 ) | NO | PRI | NULL | auto_increment |

| cust_name | varchar ( 20 ) | YES | | NULL | |

| cust_address | varchar ( 20 ) | YES | | NULL | |

| cust_city | varchar ( 25 ) | YES | | NULL | |

| cust_phone | varchar ( 25 ) | YES | | NULL | |

+ -- -- -- -- -- -- -- + -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -- +

mysql & gt ; show columns from payment ;

+ -- -- -- -- -- -- -- -- -- -- -+ -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -

| Field | Type | Null | Key | Default | Extra

+ -- -- -- -- -- -- -- -- -- -- -+ -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -

| payment_id | int ( 11 ) | NO | PRI | NULL | auto_increment

| order_id | int ( 11 ) | YES | | NULL |

| order_date | day of the month | YES | | NULL |

| payment_type | varchar ( 10 ) | YES | | NULL |

| payment_description | varchar ( 20 ) | YES | | NULL |

| sum | float ( 6,2 ) | YES | | NULL |

+ -- -- -- -- -- -- -- -- -- -- -+ -- -- -- -- -- -- -+ -- -- -- + -- -- -+ -- -- -- -- -+ -- -- -- -- -- -- -- -

3.4. Database Normalisation ( Appendices )

1NF

client ( cust_id, cust_name, cust_address, cust_city )

order ( order_id, cust_id* , item_id* , measure, item_price, total_price )

payment ( order_id* , payment_id, payment_type, payment_description, sum )

2NF

client ( cust_id, cust_name, cust_address, cust_city )

order ( order_id, cust_id* , measure, total_price )

payment ( order_id* , payment_id, payment_type, payment_description, sum )

point ( item_id, item_name, item_price, item_description )

3NF

client ( cust_id, cust_name, cust_address, cust_city )

ordered_item ( order_id, measure, total_price )

payment ( order_id* , payment_id, sum )

point ( item_id, item_name, item_price, item_description )

payment_type ( payment_type, payment_description )

3.5. Entity Relationship

There are three sorts of relationship.

One-to-one relationship means that one of each thing is used in the relationship

One-to-many relationship means one row in one tabular array is linked to many row in another tabular array.

Many-to-many relationship means many rows in one tabular array are linked to many rows in another tabular array.

3.5. SQL QUERIES

Talking to Databases Using SQL

SQL is an abbreviation for Structured Query Language. It is a surprising natural linguistic communication that allows us to `` speak '' to relational databases, such as MySQL, to bespeak and modify informations. It besides allows us to acquire information about and modify the model that contains the information, databases themselves, and tabular arraies within them. The questions formed with SQL can run from the simple to the really complex, which makes it an highly powerful tool for working with informations

Inserting, Updating, Selecting and Deleting.

Insert informations into database tabular array

The INSERT INTO statement is used to add new record in a tabular array.

Syntax

INSERT INTO table_name

VALUES ( value1, value2aˆ¦ ) [ mention ]

mysql & gt ; INSERT INTO CUSTOMERS VALUES (

- & gt ; 10, 'Gnahore Hortense ' , '34 webster route ' , 'Bermondsey ' ) ,

- & gt ; ( 11, 'Kouakou Nkruma ' , '10 Harare tribunal ' , 'London ' ) ;

mysql & gt ; SELECT * FROM CUSTOMERS ;

+ -- -- -- -- + -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- --

| CustID | NAME | ADDRESS | CITY

+ -- -- -- -- + -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- --

| 10 | Gnahore Hortense | 34 Webster route | Bermondsey

| 11 | Kouakou Nkruma | 10 Harare tribunal | London

+ -- -- -- -- + -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- --

Select informations from a database tabular array.

The SELECT statement is used to choose informations from a database.

Syntax

SELECT column_name [ mention ]

FROM table_name

mysql & gt ; SELECT * FROM CUSTOMERS ;

+ -- -- -- -- + -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- --

| CustID | NAME | ADDRESS | CITY

+ -- -- -- -- + -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- --

| 10 | Gnahore Hortense | 34 Webster route | Bermondsey

| 11 | Kouakou Nkruma | 10 Harare tribunal | London

+ -- -- -- -- + -- -- -- -- -- -- -- -- -- + -- -- -- -- -- -- -- -- -- -- + -- -- -- -- -- --

Update informations in a database bing records in a tabular array.

The UPDATE statement is used to modify informations in a tabular array.

Syntax

Update table_name

SET column1=value, column2=value2aˆ¦ [ Reference ]

WHERE some_column=some_value.

mysql & gt ; UPDATE Customers

- & gt ; SET ADDRESS ='45 clement route '

- & gt ; WHERE CustID =11 ;

Delete informations in a database

The DELETE FROM statement is used to cancel records from a database.

Syntax

DELETE FROM table_name

WHERE some_column= some value [ mention ]

3.6. Web Database Structure

Home page

Description of place page:

3.6.1. Menu construction

BAKERY FEYASSE

MAIN MENU

CUSTOMER ITEM ORDER PAYMENT

Page description:

3.6.1.1. Order page construction

BAKERY FEYASSE

Order

Choice ORDER ADD ORDER UPDATE ORDER DELETE ORDER

Page description:

3.6.1.2. Choice Order page

3.6.1.3. Add Order Page

3.6.1.4. Update Order page

3.6.1.5. Delete Order page

SQL is non sole to MySQL, nor should it be mistaken as being a portion of PHP. It 's besides non the lone database question linguistic communication out at that place. It is, nevertheless, the most popular. If you learn how to talk SQL, that cognition translates to a scope of other popular database merchandises.

Working with Existing Databases through PHP

Whether you are utilizing PHP and MySQL, or another combination, the same basic process for working with a database applies.

First, a connexion to the database waiter is established. This connexion normally lasts for the life-time of the running book. Additionally, as you will subsequently see, there are cases where they can be immediate across books.

Next, a specific database is selected to work with. Merely one database at a clip can be selected per connexion, but you can exchange to different databases without ending the connexion. You can besides hold multiple connexions established within the book, each with an independent selected database.

Finally, one time you have a connexion established and a database selected, you can get down to work with the tabular arraies within them by utilizing SQL to publish assorted bids. Datas can be retrieved, added, modified, or deleted, and alterations can be made to the selected database itself.

When finished, the connexion to the database waiter is terminated manually with mysql_close ( ) , or automatically with the terminal of the book.

Let 's take a closer expression at each measure individually

Thingss to Remember

MySQL is a popular relational database merchandise

SQL is a linguistic communication used to communiate with MySQL ( and other databases ) . It allows information to be retrevied, modified, and deleted. It besides provides a agency to modify databases and tabular arraies.

Databases are similiar to associatory arrays. Each database can incorporate one or more tabular arraies. Each tabular array is composed of records divided into Fieldss.

Working with a database through a PHP book follows this basic procedure: Connect to the waiter, select a database, execute any questions on the database, shut the connexion.

SELECT, INSERT, UPDATE, and DELETE make up SQL 's informations use bids.

The informations retreived from a tabular array can be limited in different ways: Specific columns can be returned by including them within the question, the WHERE clause can be used to to include or except specific records, and LIMIT can crest the figure of entries that are returned.

Consequences can be sorted utilizing the Order BY clause. By default, Stringing Type Fieldss are sorted alphabetically ; Numeric Type Fieldss are sorted from smallest to largest.

When making a new tabular array in a database, a alone table name must be specified. In add-on, a name, field type, and length are defined for each column in the tabular array.

In about every instance, a tabular array should hold an AUTO_INCREMENT Primary ID column defined.

All of PHP 's MySQL managing maps return False if there is an mistake in the question or the question fails. Using mysql_error ( ) returns the exact mistake reported by MySQL.

Connecting to MySQL

Merely like a multi-user computing machine system or an FTP waiter, MySQL allows different user histories to be established with single degrees of entree. To set up a connexion to MySQL, three pieces of information are required: the hostname of the database waiter, the username for the history, and the associated watchword.

This information is passed to the mysql_connect ( ) map, which attempts to set up the connexion:

$ connect = mysql_connect ( 'hostname ' , 'username ' , 'password ' ) ;

The map returns a value TRUE on success, and FALSE on failure, so it is utile ( though non necessary ) to delegate the map to a variable. In the above illustration, $ connect is used. It can be evaluated to avoid executing any extra questions if the connexion effort failed:

if ( $ connect==FALSE ) {

print `` Database connexion failed '' ;

issue ;

}

It is besides utile to hive away the consequences in a variable because the map returns a alone connexion identifier upon success. The variable so can be passed to any of PHP 's MySQL handling maps ( typically as the 2nd parametric quantity ) to stipulate thatA thisA database connexion should be used, as opposed to any other active 1s within the book.

Choosing a Database

Once a connexion is set up, the following measure is to choose a database. To make this, all that is needed is the name of an bing database:

mysql_select_db ( 'database ' ) ;

As with mysql_connect ( ) , this map returns TRUE or FALSE depending on whether the database was successfully selected. To stipulate which connexion the map should utilize, we can go through a connexion identifier to the map:

mysql_select_db ( 'database ' , $ connect ) ;

Without the 2nd parametric quantity, the map uses the database connexion that was last established within the book.

Questioning the Database

The mysql_query ( ) map is basically a PHP negligee for executing SQL bids. Any valid and complete SQL statement can be passed as a parametric quantity to this map.

Four types of questions make up SQL 's informations use statements. They are as follows: SELECT, UPDATE, INSERT, and DELETE.

SELECT

The SELECT question is used to recover informations from one or more tabular arraies within a database. As you 'll larn subsequently, we can besides choose informations from multiple tabular arraies utilizing Table Articulations, but the simplest type of SELECT statement works with merely one tabular array at a clip. The syntax looks like this:

SELECT * FROM users

Basically, this statement says, `` Select all the Fieldss in all the rows of the tabular array called users. '' The star is a wild card character that tells MySQL that it should catch anything available in the specified tabular arraies.

To bespeak this information from a PHP book, we pass the question to the mysql_query ( ) map. Because we are anticipating records to be returned from the database, the map must be assigned to a variable. The question is a twine, so PHP requires it to be surrounded by quotation marks. ( Variables are frequently passed as portion of questions and SQL requires that threading values in WHERE clauses and INSERT statements be surrounded with individual quotation marks. Though individual quotation marks can be used here, it is by and large preferred to utilize dual quotation marks for lucidity. )

$ consequence = mysql_query ( `` SELECT * FROM users '' ) ;

Merely like mysql_connect ( ) and mysql_select_db ( ) , this map will return FALSE if there is an mistake in the SQL. If the map is successful, nevertheless, $ consequence will keep a resource identifier.

Because the variable merely holds an identifier, we can non acquire any of our records by outputting $ consequence. To acquire the informations, we need to go through the consequence to another PHP map, mysql_fetch_array ( ) . This map returns an array of each record from a SELECT question, line by line. Unless you know for a fact that your question will merely return a individual record, it is advisable to utilize a piece cringle to itinerate through each row of the consequence set. The map maintains an internal topographic point grade of which record it is on, so the cringle will end one time all of the records have been returned. Let 's return to our sample database from the start of the article and the choice statement above to see how you would end product the informations:

while ( $ row = mysql_fetch_array ( $ consequence ) ) {

A A A A print $ row [ 'id ' ] . ' , '. $ row [ 'name ' ] . ' , '. $ row [ 'email ' ] . ' & lt ; br & gt ; ' ;

}

Notice that the array indexes of $ row fit the column names of the tabular array. The array generated by mysql_fetch_array ( ) can optionally be an associatory or a numeral array. By default, records are accessible by both types of keys. So, the id column ( the first column in the tabular array ) can be accessed as $ row [ 'id ' ] or $ row [ 0 ] ;

Insert

INSERT is used to add a new record to a tabular array. The syntax looks like this:

mysql_query ( `` INSERT INTO users ( 'id ' , 'name ' , 'email ' ) VALUES ( '' , 'Name ' , 'mail @ mail.com ' '' ) ;

By now, the first portion of this question should look reasonably familiar to you. It begins with the SQL bid we are traveling to execute, in this instance INSERT. Because we are infixing a new record, INTO is included, followed by the name of the tabular array we are adding it to.

The first set of parentheses surrounds a list of the Fieldss within the tabular array. These must be listed in the same order that they occur in the existent tabular array.

The 2nd part defines the values that are traveling to be added. They must fit the order of the Fieldss within the question and the tabular array for them to be inserted in the proper location.

Like the field names, SQL requires that each value be surrounded by quotation marks, because they are strings. If there is no value to be inserted, the place for the value must still be reserved by utilizing empty quotation marks.

If you are infixing values for all of the Fieldss, the field listing may be left out:

mysql_query ( `` INSERT INTO users VALUES ( '' , 'Name ' , 'mail @ mail.com ' '' ) ;

MySQL will infix the values into the columns in the order that they appear.

Update

So far we 've covered selecting and adding information to a tabular array, but what if you want to alter bing informations? Update allows us to make merely that. The basic sentence structure for an UPDATE statement looks like this:

mysql_query ( `` UPDATE users set email='test @ test.com ' '' ) ;

In this instance, we 're updating table users, and altering the value of the column called electronic mail to `` prove @ test.com '' . Take another expression at the question. You 'll detect that we have non specifiedA whichA records should hold the field electronic mail updated. If this question were run, all the Fieldss called `` electronic mail '' in all the records would be changed. To restrict the alterations to a individual ( or multiple ) particular records, the WHERE clause makes a re-appearance. In the choice statement, it was used to measure which records should be returned ; here, it is used to measure which records should be updated:

mysql_query ( `` UPDATE users set email='test @ test.com ' where id='1 ' '' ) ;

Now, merely records where the Idaho figure has a value of one will be updated.

Multiple Fieldss within the same record can besides be updated. In this illustration, both name and electronic mail are altered:

mysql_query ( `` UPDATE users set email='test @ test.com ' , name='New Name ' where id='1 ' '' ) ;

DELETE

What gets added must finally acquire deleted. The DELETE question is the simplest question and looks like this:

mysql_query ( `` DELETE FROM users where id='1 ' ) ;

Because full records are deleted, there is no demand to stipulate a field list. The WHERE clause is indispensable ; without it, all the records in the tabular array would be removed.

A Scripting LanguageA - can go through SQL questions to the waiter and expose the consequence.

A Remote ClientA - a programme on a different machine that can link to the waiter and run SQL statements.

You can besides utilize two more indirect methods.

Remote LoginA - You may be able to link to the Server Machine to run one of its local clients.

Web BrowserA - you can utilize a web browser and books that person has written ( we 're traveling to utilize this method for the remainder of the workshop ) .

A individual utilizing their web browser asks for a dynamic PHP web page, the webserver has been configured to recognize the.php extension and passes the file to the PHP translator which in bend base on ballss an SQL question to the MySQL waiter returning consequences for PHP to expose. You can besides utilize the PHP book to end product HTML around the consequences to guarantee that the consequences are formatted nicely for show within a browser. It is critical that the file has a.php extension or the web waiter will non cognize to go through it to the translator.

Updated: May 19, 2021
Cite this page

Web Database Based Inventory System Computer Science Essay. (2020, Jun 02). Retrieved from https://studymoose.com/web-database-based-inventory-system-computer-science-new-essay

Web Database Based Inventory System Computer Science Essay essay
Live chat  with support 24/7

👋 Hi! I’m your smart assistant Amy!

Don’t know where to start? Type your requirements and I’ll connect you to an academic expert within 3 minutes.

get help with your assignment