lecture 3 mysql database. php mysql connection mysql is a database system used on the web mysql is a...
TRANSCRIPT
![Page 1: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/1.jpg)
LECTURE 3
MYSQL Database
![Page 2: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/2.jpg)
PHP MYSQL CONNECTIONMySQL is a database system used on the webMySQL is a database system that runs on a serverMySQL is ideal for both small and large applicationsMySQL is very fast, reliable, and easy to useMySQL uses standard SQLMySQL compiles on a number of platformsMySQL is free to download and useMySQL is developed, distributed, and supported by Oracle CorporationMySQL is named after co-founder Monty Widenius's daughter: My
![Page 3: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/3.jpg)
PHP + MySQL Database System
• PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)
![Page 4: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/4.jpg)
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 "<h1>".$row->id."</h1>";
echo "<h1>".$row->login."</h1>";echo "<h1>".$row->password."</h1>";
echo "<h1>".$row->age."</h1>"; echo "<h1>".$row->full_name."</h1>";}
}?>
![Page 5: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/5.jpg)
RESULT:
![Page 6: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/6.jpg)
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) “);
}
?>
![Page 7: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/7.jpg)
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 = 18WHERE id = 3
”);}
?>
![Page 8: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/8.jpg)
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”);}
?>
![Page 9: 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](https://reader036.vdocuments.site/reader036/viewer/2022082821/5697c0071a28abf838cc6152/html5/thumbnails/9.jpg)
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