Tutorial 6 PHP & MySQL Li Xu

Slides:



Advertisements
Similar presentations
TRAINING PHP ALUMNI DAN CALON ALUMNI STMIK SURABAYA Teguh Sutanto Sistem Informasi | STMIK Surabaya Juni 2014.
Advertisements

1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
PHPPHP What is PHP? Hypertext Pre-processor (PHPs) is a server- side scripting language In early versions, PHP stand for Personal Home Page. server-side.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
Intro to PHP Introduction to server-side scripts (It’s all good :D) © TAFE NSW
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
CSE3310: Web training A JumpStart for Project.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
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.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Mini Group Presentations: php by Veronica Black + Jia Xu.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Basics and uses of php Prepared By
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
Introduction to PHP Advanced Database System Lab no.1.
What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Introduction to PHP.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
PHP Database Pemrograman Internet. PHP MySQL Database With PHP, you can connect to and manipulate databases. MySQL is the most popular database system.
PHP Introduction PHP is a server-side scripting language.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
CHAPTER 10 PHP MySQL Database
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 1 Introduction to PHP Hypertext Preprocessor - PHP.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
1 Server Side scripting PHP. 2 What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are.
 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.
A pache M ySQL P hp Robert Mudge Reference:
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
PHP Built-In Functions
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Introduction to Web programming
Introduction to Web programming
PHP (PHP: Hypertext Preprocessor)
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
PHP / MySQL Introduction
PHP Variables A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume) Rules for PHP variables: A variable.
PHP Introduction.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Introduction to Web programming
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
IntroductionToPHP Static vs. Dynamic websites
Intro to PHP.
Introduction to PHP.
PHP Forms and Databases.
PHP an introduction.
23 PHP.
Introduction to Web programming
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Web Application Development Using PHP
Presentation transcript:

Tutorial 6 PHP & MySQL Li Xu Email: xuli@se.cuhk.edu.hk Department of Systems Engineering and Engineering Management

Outline PHP: Hypertext Preprocessor PHP Introduction PHP Syntax PHP Variables PHP Functions MySQL Database MySQL Introduction MySQL Connect MySQL Create DB MySQL Operations

PHP Introduction What is PHP? What is a PHP File? an acronym for “PHP: Hypertext Preprocessor” a widely-used, open source scripting language PHP scripts are executed on the server free to download and use What is a PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have extension ".php"

PHP Introduction What can PHP do? Why PHP? generate dynamic page content create, open, read, write, delete, and close files on the server collect form data send and receive cookies add, delete, modify data in your database be used to control user-access encrypt data Why PHP? run on various platforms (Windows, Linux, Unix, etc.) compatible with almost all servers used today (Apache, IIS, etc.) supports a wide range of databases

PHP Syntax Basic PHP Syntax Comments in PHP A PHP script can be placed anywhere in the docment, and starts with ‘<?php’ and ends with ‘?>’ The default file extension for PHP files is “.php” Comments in PHP

PHP Syntax PHP Case Sensitivity In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive. However, all variable names are case-sensitive

PHP Variables Creating (Declaring) PHP Variables In PHP, a variable starts with the $ sign, followed by the name of the variable: PHP has no command for declaring a variable, it is created the moment you first assign a value to it. A variable name must start with a letter or the underscore character, cannot start with a number. A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) Variable names are case-sensitive ($age and $AGE are two different variables)

PHP Variables Output Variables PHP is a loosely typed language The PHP echo statement is often used to output data to the screen: PHP is a loosely typed language PHP automatically converts the variable to the correct data type, depending on its value

PHP Functions Create a user defined function in PHP A user-defined function declaration starts with the word function: PHP function arguments Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma.

PHP Functions PHP default argument value Returning values

MySQL Introduction What is MySQL? Download MySQL Database a database system used on the web, runs on a server ideal for both small and large applications fast, reliable, and easy to use use standard SQL complies on a number of platforms free to download and use Download MySQL Database If you don’t have a PHP server with a MySQL Database, you can download it for free via http://www.mysql.com

MySQL Connect PHP connect to MySQL Open a connection to MySQL MySQLi Object-Oriented PHP connect to MySQL PHP 5 and later can work with a MySQL database using: MySQLi extension (the “i” stands for imporved): http://php.net/manual/en/mysqli.installation.php PDO (PHP Data Objects) http://php.net/manual/en/pdo.installation.php Open a connection to MySQL Before we can access data in the MySQL database, we need to be able to connect to the server PDO

MySQL Connect PHP connect to MySQL Close the connection MySQLi Object-Oriented: $conn->close(); PDO: $conn = null;

MySQL Create DB A database consists of one or more tables, you can use special CREATE privileges to create a MySQL database: Create a MySQL Database using MySQLi Create a MySQL Database using PDO

MySQL Operations (SQL) Create a table: Insert data: Select data: select data from one or more tables: SELECT column_name(s) FROM table_name select all columns from a table: SELECT * FROM table_name

MySQL Operations (SQL) Delete data from MySQL: e.g.: delete from MyGuests where id=3 Update data: e.g.: update MyGuests set lastname=‘Doe’ where id=2

Resources PHP: https://www.w3schools.com/php/default.asp MySQL: https://www.w3schools.com/php/php_mysql_intro.asp

Questions and Answers