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

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

PHP: Date() Function The PHP date() function formats a timestamp to a more readable date and time.
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
SWU, Computer systems and technologies. The Objective of This Lecture To give you a very high-level overview of some of the tools for Web Programming.
Intermediate PHP & MySQL
PHP & MySQL Mahak Arora Vivek Bangera. Outline How PHP works Basic scripting in PHP Forms in PHP(GET & POST Variables) SQL basics PHP and MySQL connection.
U NIT 4 F ILE U PLOAD. I. C REATE AN U PLOAD -F ILE F ORM - With PHP, it is possible to upload files to the server.To allow users to upload files from.
Kyle MacLachlan.  Used To Format a Date/Time  Syntax: › date(format,timestamp)  format: Required, specifies format  timestamp:Optional, specifies.
04/09/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
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.
PHP Tutorial By RAY BALIKI && ROY GHORAYEB. DEFINITION PHP is a powerful server-side scripting language for creating dynamic and interactive websites.
INTRODUCTION TO PHP Basic concept of PHP and Much More Prepared By: Farhan Nisar(7 th Semester) University of Peshawar.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
INTERNET APPLICATION DEVELOPMENT For More visit:
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
COMP Week 5 Dr. Chunbo Chu. Agenda 1. Brief History of PHP 2. Basics 3. Advanced.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Mandakini Ayushi Infotech Mandakini Kumari 22 nd July PHP Basic.
PHP - Hypertext Preprocessor. Introduction PHP is a powerful server-side scripting language for creating dynamic and interactive websites. PHP is a powerful.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
INTERNET APPLICATION DEVELOPMENT For More visit:
PHP MySQL Introduction
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
PHP3. PHP File Upload With PHP, it is possible to upload files to the server. Create an Upload-File Form To allow users to upload files from a form can.
PHP Arrays. Outline o What is array in PHP ? o Numeric array o Associative array o Multidimensional array.
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
PHP Advance. Agenda Server side Includes File Handling Cookies Sessions Error/Exception handling Database handling with MySQL sending.
PHP meets MySQL.
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.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
INTERNET APPLICATION DEVELOPMENT Practical on Sessions.
PHP - Introduction Week 5 Dr. Ken Cosh Introducing PHP 1.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Web Programming Language Week 5 Dr. Ken Cosh Introducing PHP 1.
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.
Julian Springer Room 42 Joe Slovo.  W3 schools recommend that you have a basic understanding of HTML and of JavaScript before attempting to grasp PHP.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
PHP Arrays By Justin Nelsen. What is an Array? - An array can store one or more values in a single variable name. -Each element in the array is assigned.
Web Programming Language Week 7 Dr. Ken Cosh PHP and storage.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
PHP Error Handling Section :I Source: 1.
CHAPTER 10 PHP MySQL Database
Introduction to PHP Brendan Knight. What is PHP PHP is a general-purpose scripting language originally designed for web development to produce dynamic.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
8 th Semester, Batch 2008 Department of Computer Science SSUET.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
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.
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.
Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.
PHP & MY SQL Instructor: Monireh H. Sayadnavard 1.
Web Systems & Technologies
Tried my best to simplify it for you!
PHP Functions Besides the built-in PHP functions, we can create our own functions. A function is a block of statements that can be used repeatedly in.
8th Semester, Batch 2008 Department of Computer Science SSUET.
Basic PHP Lecture by Nutthapat Keawrattanapat
Basics (Cont...).
محمد احمدی نیا PHP محمد احمدی نیا
PHP PROF. S. LAKSHMANAN, DEPT. OF B. VOC. (SD & SA),
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.
Presentation transcript:

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

PHP - XAMPP

PHP – NetBeans IDE

Netbeans- default browser

Netbeans – Starts a project

PHP – Starting a project

Netbeans – Setting a project

Basic PHP Syntax

Comment in Php

PHP Variables <?php $txt="Hello World!"; $x=16; echo $txt; ?> Hello World!

PHP Operators ArithmeticAssignmentComparisonLogicalString +== &&. (Append) -+=! =|| *-= ! /*=> %/=> = ++%=< - < =

if

if

switch

Numeric Arrays $cars=array("Saab","Volvo","BMW","Toyota"); or $cars[0]="Saab"; $cars[1]="Volvo"; $cars[2]="BMW"; $cars[3]="Toyota"; echo $cars[0]. " and ". $cars[1]. " are Swedish cars.";

Associative Arrays ID key => value $ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34); or $ages['Peter'] = "32"; $ages['Quagmire'] = "30"; $ages['Joe'] = "34"; echo "Peter is ". $ages['Peter']. " years old."; Peter is 32 years old.

Multidimensional Arrays $families = array ( "Griffin"=>array ( "Peter", "Lois", "Megan" ), "Quagmire"=>array ( "Glenn" ), "Brown"=>array ( "Cleveland", "Loretta", "Junior" ) ); Array ( [Griffin] => Array ( [0] => Peter [1] => Lois [2] => Megan ) [Quagmire] => Array ( [0] => Glenn ) [Brown] => Array ( [0] => Cleveland [1] => Loretta [2] => Junior ) )

Multidimensional Arrays echo "Is ". $families['Griffin'][2]. " a part of the Griffin family?"; Is Megan a part of the Griffin family?

While Loops "; $i++; } ?> The number is 1 The number is 2 The number is 3 The number is 4 The number is 5

Do While Loops "; } while ($i The number is 2 The number is 3 The number is 4 The number is 5 The number is 6

For Loops "; } ?> The number is 1 The number is 2 The number is 3 The number is 4 The number is 5

Foreach Loops <?php $x=array("one","two","three"); foreach ($x as $value) { echo $value. " "; } ?> one two three

Create a PHP Function My name is Kai Jim Refsnes

Create a PHP Function "; } echo "My name is "; writeName("Kai Jim"); echo "My sister's name is "; writeName("Hege"); echo "My brother's name is "; writeName("Stale"); ?> My name is Kai Jim Refsnes. My sister's name is Hege Refsnes. My brother's name is Stale Refsnes.

Create a PHP Function "; } echo "My name is "; writeName("Kai Jim","."); echo "My sister's name is "; writeName("Hege","!"); echo "My brother's name is "; writeName("Ståle","?"); ?> My name is Kai Jim Refsnes. My sister's name is Hege Refsnes! My brother's name is Ståle Refsnes?i

Create a PHP Function = 17

$_GET variable Name: Age: Welcome. You are years old! When using method="get" in HTML forms, all variable names and values are displayed in the URL.

$_POST variable Name: Age: Welcome ! You are years old. Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. However, because the variables are not displayed in the URL, it is not possible to bookmark the page.

$_REQUEST Variable Welcome ! You are years old The predefined $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE. The $_REQUEST variable can be used to collect form data sent with both the GET and POST methods.

PHP Date() Function date(format [, timestamp]) "; echo date("Y-m-d"); ?> 2011/11/

PHP Date() Function mktime(hour,minute,second,month,day,year,is_dst) Tomorrow is 2011/11/18

PHP include() Function Welcome to my home page! Some text.

PHP include() Function menu.php Home Tutorials References Examples About Us Contact Us Welcome to my home page. Some text.

PHP File Handling Reading a File Line by Line "; } fclose($file); ?>

PHP File Handling Reading a File Character by Character

PHP File Upload Create an Upload-File Form Filename:

Create The Upload Script upload_file.php 0) { echo "Error: ". $_FILES["file"]["error"]. " "; } else { echo "Upload: ". $_FILES["file"]["name"]. " "; echo "Type: ". $_FILES["file"]["type"]. " "; echo "Size: ". ($_FILES["file"]["size"] / 1024). " Kb "; echo "Stored in: ". $_FILES["file"]["tmp_name"]; } ?>

Save uploaded File upload_file.php

Create a Cookie setcookie(name, value, expire, path, domain); 60 sec * 60 min * 24 hours * 30 days

Retrive a Cookie "; else echo "Welcome guest! "; ?>

Delete a Cookie

PHP Session Variables Starting a PHP Session Before you can store user information in your PHP session, you must first start up the session. Note: The session_start() function must apear BEFORE the tag:

PHP Session Variables

PHP Session Variables

PHP Destroying a Session Free a session variable

PHP mail() Function

PHP mail() Function Subject: Message: "; } ?>

Error Handling

Error Handling Error: [$errno] $errstr "; echo "Ending Script"; die(); } //set error handler set_error_handler("customError",E_USER_WARNING); //trigger error $test=2; if ($test>1) { trigger_error("Value must be 1 or below",E_USER_WARNING); } ?>

Error Handling 1) { throw new Exception("Value must be 1 or below"); } return true; } //trigger exception in a "try" block try { checkNum(2); //If the exception is thrown, this text will not be shown echo 'If you see this, the number is 1 or below'; } //catch exception catch(Exception $e) { echo 'Message: '.$e->getMessage(); } ?> Message: Value must be 1 or below

Filter & Sanitize Check if the "url" input of the "POST" type exists If the input variable exists, sanitize (take away invalid characters) and store it in the $url variable "

MySQL Workbench

Connect / Close a DB mysql_connect(servername,username,password);

Create a Database if (mysql_query("CREATE DATABASE my_db",$con)) { echo "Database created"; } else { echo "Error creating database: ". mysql_error(); }

Create a Table // Create table mysql_select_db("my_db", $con); $sql = "CREATE TABLE Persons ( FirstName varchar(15), LastName varchar(15), Age int )"; // Execute query mysql_query($sql,$con);

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

Insert a Table mysql_select_db("my_db", $con); mysql_query("INSERT INTO Persons (FirstName, LastName, Age) VALUES ('Peter', 'Griffin', '35')"); mysql_query("INSERT INTO Persons (FirstName, LastName, Age) VALUES ('Glenn', 'Quagmire', '33')");

Insert Data From a Form Into a Database Firstname: Lastname: Age:

Insert Data From a Form Into a Database mysql_select_db("my_db", $con); $sql="INSERT INTO Persons (FirstName, LastName, Age) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')"; if (!mysql_query($sql,$con)) { die('Error: '. mysql_error()); } echo "1 record added";

Select Data From a Database Table "; } mysql_close($con); ?>

Display the Result in an HTML Table Firstname Lastname "; while($row = mysql_fetch_array($result)) { echo " "; echo " ". $row['FirstName']. " "; echo " ". $row['LastName']. " "; echo " "; } echo " "; mysql_close($con); ?>

The WHERE clause "; } ?>

Update Data In a Database

Delete Data In a Database