13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

9<br />

Creating Your <strong>Web</strong> Database<br />

IN THIS CHAPTER, WE EXPLAIN HOW TO set up a <strong>MySQL</strong> database for use on a website.<br />

Key topics covered in this chapter include<br />

n Creating a database<br />

n Setting up users <strong>and</strong> privileges<br />

n Introducing the privilege system<br />

n Creating database tables<br />

n Creating indexes<br />

n Choosing column types in <strong>MySQL</strong><br />

In this chapter, we follow through with the Book-O-Rama online bookstore application<br />

discussed in the preceding chapter. As a reminder, here is the schema for the Book-O-<br />

Rama application:<br />

Customers(CustomerID, Name, Address, City)<br />

Orders(OrderID, CustomerID, Amount, Date)<br />

Books(ISBN, Author, Title, Price)<br />

Order_Items(OrderID, ISBN, Quantity)<br />

Book_Reviews(ISBN, Reviews)<br />

Remember that each primary key is underlined <strong>and</strong> each foreign key is italic.<br />

To use the material in this section, you must have access to <strong>MySQL</strong>.This usually<br />

means that you have completed the basic install of <strong>MySQL</strong> on your web server.This step<br />

includes<br />

n Installing the files<br />

n Setting up a user for <strong>MySQL</strong> to run as

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!