Presentation is loading. Please wait.

Presentation is loading. Please wait.

LECTURE 3 MYSQL Database. PHP MYSQL CONNECTION MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal.

Similar presentations


Presentation on theme: "LECTURE 3 MYSQL Database. PHP MYSQL CONNECTION MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal."— Presentation transcript:

1 LECTURE 3 MYSQL Database

2 PHP MYSQL CONNECTION MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal for both small and large applications MySQL is very fast, reliable, and easy to use MySQL uses standard SQL MySQL compiles on a number of platforms MySQL is free to download and use MySQL is developed, distributed, and supported by Oracle Corporation MySQL is named after co-founder Monty Widenius's daughter: My

3 PHP + MySQL Database System PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

4 Example (MySQLi Object-Oriented) <?php $connection = new mysqli("localhost","ilyasgalacticos","","facebook"); $connected = false; if(!$connection->connect_error){ $connected = true; } if($connected){ $query = $connection->query(“ SELECT * FROM users “); while($row = $query->fetch_object()){ echo " ".$row->id." "; echo " ".$row->login." "; echo " ".$row->password." "; echo " ".$row->age." "; echo " ".$row->full_name." "; } ?>

5 RESULT:

6 INSERTING <?php $connection = new mysqli("localhost","ilyasgalacticos","","facebook"); $connected = false; if(!$connection->connect_error){ $connected = true; } if($connected){ $query = $connection->query(“ INSERT INTO users (id, login, full_name, password, age) VALUES (NULL,\”aziza\”, \” Aziza Kamet\”, \” qwerty\”, 19) “); } ?>

7 UPDATING <?php $connection = new mysqli("localhost","ilyasgalacticos","","facebook"); $connected = false; if(!$connection->connect_error){ $connected = true; } if($connected){ $query = $connection->query(“ UPDATE users SET login = \“symbat\”, age = 18 WHERE id = 3 ”); } ?>

8 DELETING <?php $connection = new mysqli("localhost","ilyasgalacticos","","facebook"); $connected = false; if(!$connection->connect_error){ $connected = true; } if($connected){ $query = $connection->query(“ DELETE FROM users WHERE id = 3 ”); } ?>

9 USING MYSQL in C9 In bash terminal(command line) to install mysql: mysql-ctl install To start mysql: mysql-ctl start To install phpmyadmin: phpmyadmin-ctl install


Download ppt "LECTURE 3 MYSQL Database. PHP MYSQL CONNECTION MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal."

Similar presentations


Ads by Google