PHP & MY SQL Instructor: Monireh H. Sayadnavard 1.

Slides:



Advertisements
Similar presentations
XAMPP: Cross – Apache, MySQL, Php, Perl + FileZilla, Tomcat NetBeans: IDE PHP Installation.
Advertisements

Intermediate PHP & MySQL
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables. A table is a collections of related data entries and.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
INTERNET APPLICATION DEVELOPMENT For More visit:
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
PHP MySQL Introduction
PHP – MySQL Extensions. Table used in most examples CREATE TABLE product ( rowID INT NOT NULL AUTO_INCREMENT, productid VARCHAR(8) NOT NULL, name VARCHAR(25)
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
ITCS373: Internet Technology Server-Side Programming PHP – Part 2 Dr. Faisal Al-Qaed.
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
PHP. Basic SQL definition: Database A database which structures data in the form of tables. Each table contains information relevant to a particular.
Databases in Visual Studio. Database in VisualStudio An MS SQL database are built in Visual studio The Name can be something like ”(localdb)\Projects”
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
1. Connecting database from PHP 2. Sending query 3. Fetching data 4. Persistent connections 5. Best practices.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
SQL Basics. 5/27/2016Chapter 32 of 19 Naming SQL commands are NOT case sensitive SQL commands are NOT case sensitive But user identifier names ARE case.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
2010/11 : [1]PHP with MySQLBuilding Web Applications using MySQL and PHP (W1) PHP with MySQL.
Phonegap Bridge – File System CIS 136 Building Mobile Apps 1.
Web Programming Language Week 7 Dr. Ken Cosh PHP and storage.
SQL Unit – 2 Base Knowledge Presented By Mr. R.Aravindhan.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
SQL Structured Query Language 1. Data Definition Language (DDL) is used to manage table and define data structure i.e. CREATE, ALTER, DROP Data Control.
SQL. คำสั่ง SQL SQL stands for Structured Query Language is a standard language for accessing and manipulating databases.
What’s a database? Data stored in a structured format that lends itself to easy manipulation and recall.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Module Review Basic SQL commands: Create Database, Create Table, Insert and Select 2. Connect an SQL Database to PHP 3. Execute SQL Commands in.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
PHP: MySQL. PHP Connect to MySQL PHP 5 and later can work with a MySQL database using: – MySQLi extension (the "i" stands for improved) – PDO (PHP Data.
PHP Database Pemrograman Internet. PHP MySQL Database With PHP, you can connect to and manipulate databases. MySQL is the most popular database system.
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
>> Introduction to MySQL. Introduction Structured Query Language (SQL) – Standard Database Language – Manage Data in a DBMS (Database Management System)
CHAPTER 10 PHP MySQL Database
There are two types of MySQL instructions (Data Definition Language) DDL: Create database, create table, alter table,,,. (Data Manipulation Language) DML.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
Spring 2011 ITCS3160: Database Design and Implementation Hands-on Learning.
به نام خدا SQL QUIZ جوانمرد Website: ejavanmard.blogfa.com.
SQL Reminder Jiankang Yuan Martin Lemke. SQL Reminder - SELECT SELECT column_name1, column_name2, … FROM table_name SELECT * FROM table_name.
 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.
Tried my best to simplify it for you!
PHP: MySQL Lecture 14 Kanida Sinmai
Web Systems & Technologies
Session 4 PHP & MySQL.
Server-Side Application and Data Management IT IS 3105 (FALL 2009)
Introduction to Web programming
Unit 2 MY SQL DATABASE PROGRAMMING
PHP + MySQL Commands Refresher.
PhpMyaAmin & MySQL PHP: Hypertext Preprocessor.
ISC440: Web Programming 2 Server-side Scripting PHP 3
SQL Tutorial.
PHP: Combo box FdSc Module 109 Server side scripting and
محمد احمدی نیا PHP محمد احمدی نیا
Web Programming– UFCFB Lecture
PHP AND MYSQL.
MySQL Database System Installation Overview SQL summary
កម្មវិធីបង្រៀន SQL Programming ជាភាសាខ្មែរ Online SQL Training Course
Introduction to Web programming
Conection
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
SQL NOT NULL Constraint
Presentation transcript:

PHP & MY SQL Instructor: Monireh H. Sayadnavard 1

Create a Connection to a MySQL Database نام کاربریکلمه عبور این قسمت وقتی اجرا می گردد که اتصال fail شود 2

Closing a Connection 3

Choosing a data base  $select = mysql_select_db ("mydb") or  $select = mysql_select_db("mydb", $con); 4

Create a Table CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type,.... ) 5

Create a Table(Example) $sql = "CREATE TABLE Persons ( FirstName varchar(15), LastName varchar(15), Age int )"; 6

Create a Table(Example) $sql = "CREATE TABLE Persons ( personID int NOT NULL AUTO_INCREMENT, PRIMARY KEY(personID), FirstName varchar(15), LastName varchar(15), Age int )"; 7

Insert Data INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...) 8

Insert (example) mysql_query("INSERT INTO Persons (FirstName, LastName, Age) VALUES ('Peter', 'Griffin',35)"); 9

Select Data SELECT column_name(s) FROM table_name Example ◦ $result = mysql_query("SELECT * FROM Persons"); while($row = mysql_fetch_array($result)) { echo $row['FirstName']. " ". $row['LastName']; echo " "; } در این مثال نتیجه کوئری در متغیر result ذخیره می شود. سپس از تابع fetch استفاده می کنیم که ردیف اول recordset را به عنوان یک آرایه بر میگرداند ( آرایه row). هر فراخوانی تابع fetch ردیف بعدی از رکوردها را برمیگرداند و... 10

Display the Result in a Table $result = mysql_query("SELECT * FROM Persons"); echo " Firstname Lastname "; while($row = mysql_fetch_array($result)) { echo " "; echo " ". $row['FirstName']. " "; echo " ". $row['LastName']. " "; echo " "; } echo " "; 11

The WHERE clause SELECT column_name(s) FROM table_name WHERE column_name operator value Example ◦ $result = mysql_query("SELECT * FROM Persons WHERE FirstName='Peter'"); 12

ORDER BY SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC 13

ORDER BY $result = mysql_query("SELECT * FROM Persons ORDER BY age"); while($row = mysql_fetch_array($result)) { echo $row['FirstName']; echo " ". $row['LastName']; echo " ". $row['Age']; echo " "; } 14

Update Data In a Database UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Example ◦ mysql_query("UPDATE Persons SET Age=36 WHERE FirstName='Peter' AND LastName='Griffin'"); 15

Delete Data In a Database DELETE FROM table_name WHERE some_column = some_value Example ◦ mysql_query("DELETE FROM Persons WHERE LastName='Griffin'"); 16

MYSQL Functions 17

The $_POST Variable این متغیر برای دسترسی به داده های فرمی با متد post (method=“post”) استفاده می شود. Name: Age: Welcome ! You are years old. 18

mysql_affected_rows() Returns the number of affected rows in the previous MySQL operation 19

mysql_num_rows() Returns the number of rows in a recordset 20

mysql_fetch_array() Returns a row from a recordset as an associative array and/or a numeric array 21

mysql_fetch_row() Returns a row from a recordset as a numeric array 22