ICT 5 Web Development - Chapter : Using MySQL with PHP To learn how to prepare a MySQL database for use with PHP; To learn how to store, retrieve, and update data in a MySQL database in a MySQL data. | Vietnam and Japan Joint ICT HRD Program Objectives To understand the advantages of using d t b i databases to store Web data t t W bd t To learn how to prepare a MySQL database for use with PHP To learn how to store, retrieve, and update data in a MySQL database ICT 5 Web Development Chapter . Using MySQL with PHP Nguyen Thi Thu Trang trangntttrangntt-fit@ 2 Content What is a database? 1. Database and MySQL Overview 2. Basic SQL commands 3. Creating a table 4. Inserting data to a table 5. Retrieving data from a table 6. Updating data for a table A set of data organized into one or more computer files. t fil Using files for product inventory is a type of database Generally the term is reserved for more formal database systems like access, Oracle or MySQL. 3 4 1 Advantages of Databases Over Files Relational Database? Faster access Better concurrent access Easier changes to data and scripts Increased security A database is a collection of tables with defined relationships between them Columns define attributes of the data – All data in a column must have the same data type A record is stored in a row table name row First Name Nadia Madhu Ajuma Wade Helen column 5 Which Database System Employees Last Name Phone Li 2687 Charu 7856 Kinsaka 4489 Randal 5257 Clark 2147 6 Using A Query Language PHP works with a variety of databases that include: d t b th t i l d When using a database, use a separate query language to work t l t k with database Within MySQL, use Structured Query Language (SQL), to access database – Oracle – Access – Ingres – SQL Server – MySQL PHP Script Will use MySQL since simple to use, free and very popular. 7 Send SQL Query Query Results MySQL Database 8 2 2. Basic SQL commands Content - Connecting to MySQL from the Command Line mysql -uusername -p 1. Database and MySQL Overview 2. Basic SQL commands 3. Creating a table 4. Inserting data to a table 5. Retrieving data from a table 6. Updating data .