This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Create Database configuration */ | |
$server = "localhost"; | |
$username = "root"; | |
$password = ""; | |
$database = "Library"; | |
/* Begin Connection */ | |
try{ | |
/* Setup PDO Connection */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Query N° 8 : Get customers with Ahmed or Rida as a name */ | |
select * from customer where LN='Ahmed' or LN='Rida' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Query n° 7 : Select users with Ahmed as name AND zipCode 28932 */ | |
select * from customer where LN = 'Ahmed' and zipCode = 28932 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Query N° 6 : Select customers with 'Ahmed' as name */ | |
Select * from customer where LN = 'Ahmed' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Query n° 5 : Select Distinct */ | |
SELECT DISTINCT type from orders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Change Type column to thetime */ | |
ALTER TABLE orders CHANGE COLUMN type thetime varchar(50); | |
/* Change time column to Type */ | |
ALTER TABLE orders CHANGE COLUMN time type varchar(50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Query N° 3 : Select from table using Alias */ | |
SELECT custID as ' ID Client ', LN as ' Last Name ', FN as ' First Name ' from customer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Query N° 2 : Select Customized fields from table */ | |
Select custID,LN,FN from customer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* First Query : Select all data from table */ | |
Select * from customer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT into orders values | |
(1,1,'9/29/2018','14:02','reuglar order'), | |
(2,1,'9/29/2018','14:30','reuglar order'), | |
(3,3,'9/29/2018','17:22','Big Meal order') |