Princess Nourah bint Abdulrahman University. Computer Sciences Department

Similar documents
PHP 5 if...else...elseif Statements

Download and Installation Instructions: After WAMP Server download start the installation:

Web Application Development (WAD) V th Sem BBAITM (Unit 4) By: Binit Patel

Form Processing in PHP

PHP Introduction. Some info on MySQL which we will cover in the next workshop...

MySQL: Access Via PHP

PHP Development - Introduction

What is WAMP5? Top Next

Database Connectivity using PHP Some Points to Remember:

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted)

Princess Nourah bint Abdulrahman University. Computer Sciences Department

COMS 469: Interactive Media II

JSON POST WITH PHP IN ANGULARJS

INSTALLING RACHEL ON SYNOLOGY GIAKONDA IT

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity]

Database connection 1

School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University

PHP. M hiwa ahamad aziz Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz)

Locate your Advanced Tools and Applications

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL

Web Server Setup Guide

File uploading in PHP

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL.

More loops. Control structures / flow control. while loops. Loops / Iteration / doing things over and over and over and over...

Setting up the Master Computer

SQL stands for Structured Query Language. SQL lets you access and manipulate databases

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

Overview of MySQL Structure and Syntax [2]

SMS GATEWAY API INTEGRATION GUIDE

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly

Guide for Building Web Application Using PHP and Mysql

Sugar Enterprise 6.5 Offline Client Guide

Apache, Php, MySql Configuration

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

Developing Online Databases and Serving Biological Research Data

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Drupal

If Only. More SQL and PHP

Bitnami Dolibarr for Huawei Enterprise Cloud

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier

Host at 2freehosting.Com

PHP Tutorial 6(a) Using PHP with MySQL

App Central: Developer's Guide. For APKG 2.0

Almost all new data created today is digital Problem: How to organize the data and store it? Capacity Speed Life of the data Number of users

Web Focused Programming With PHP

PHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase

WebEA Quick Start Guide

CMS and e-commerce Solutions. version 1.0. Please, visit us at: or contact directly by

Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

By the end of this section of the practical, the students should be able to:

TM-800/1000 and TS-700/900 Administrator Manual

Joomla 3.X Global Settings Part III Server Settings

CSE 154 LECTURE 9: SUBMITTING DATA (POST)

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to:

User authentication, passwords

Understanding Basic SQL Injection

Bitnami Tiny Tiny RSS for Huawei Enterprise Cloud

EXPERIMENT- 9. Login.html

Phpmyadmin Windows Xp

Introductory workshop on PHP-MySQL

Advanced Web Tutorial 10

Using PHP with MYSQL

Developing Online Databases and Serving Biological Research Data

PHP Hypertext Preprocessor

Working with Databases

PHP Arrays. Lecture 20. Robb T. Koether. Hampden-Sydney College. Wed, Feb 28, 2018

Bitnami Coppermine for Huawei Enterprise Cloud

CSC System Development with Java. Database Connection. Department of Statistics and Computer Science. Budditha Hettige

Get started with Efficient Documents Management System. Stephane Van de Putte, The NO-SOD Project

Forms, CGI. Objectives

Client Side Scripting. The Bookshop

Installing LAMP on Ubuntu and (Lucid Lynx, Maverick Meerkat)

Submitting forms (client-side)

Simulation Manager Configuration Guide

Web Security. Attacks on Servers 11/6/2017 1

COM1004 Web and Internet Technology

A340 Laboratory Session #17

TIMESIMPLICITY EMPLOYEE GUIDE V1(0317D)

Edge Linux Installation Guide V 4.5

Figure 1 Forms category in the Insert panel. You set up a form by inserting it and configuring options through the Properties panel.

Chapter. Accessing MySQL Databases Using PHP

Bitnami Piwik for Huawei Enterprise Cloud

Web Engineering (Lecture 08) WAMP

Chapter 7 PHP Files & MySQL Databases

Connecting BioNumerics to MySQL

WAMP Bundle installation guide for CCSuite

Open Source Web Application Development - CS310

Linux Network Administration. MySQL COMP1071 Summer 2017

Bitnami ProcessMaker Community Edition for Huawei Enterprise Cloud

BLBSH NEWS AND STATS. v1.3 DOCUMENTATION

Database Systems Fundamentals

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 (

Courtesy of Clayton Fyfe. Lab 2 Runthrough

MULTI-NODE DATABASE APPLICATION DEPLOYMENT ON LAMP ARCHITECTURE

Apache Install Instructions Win7 7 Php Mysql. Phpmyadmin Linux >>>CLICK HERE<<<

Bitnami Pimcore for Huawei Enterprise Cloud

Use of PHP for DB Connection. Middle and Information Tier

Course Wiki. Today s Topics. Web Resources. Amazon EC2. Linux. Apache PHP. Workflow and Tools. Extensible Networking Platform 1

Publish Joomla! Article

Transcription:

Princess Nourah bint Abdulrahman University Computer Sciences Department 1

And use http://www.w3schools.com/

PHP Part 3

Objectives Creating a new MySQL Database using Create & Check connection with Database that has been created. Creating a new table Form Handling GET vs. POST methods Insert, select, delete, update data Computer Sciences Department 4

Creating a new MySQL Database Computer Sciences Department 5

Step 1 After WAMP server has started, you will see the WAMP icon as shown below in the notification area at the bottom-right side of the desktop. If the icon is green as shown above, all services like Apache, MySQL etc. are running. If the icon is not green, left-click on it. You will see the WAMP administrator panel as shown below. Click on Start All Services. Computer Sciences Department 6

Step 2 Click on phpmyadmin under the Tools section. Log in with Username and Password for MySQL. Generally, the Username is "root" with no Password required for the Super user of MySQL Computer Sciences Department 7

Step 3 create a new Database Note: Don't use a dot(. ) in the database name Computer Sciences Department 8

Step 4 create a new Table 1 2 3 4 Computer Sciences Department 9

Step 5 Create new field Computer Sciences Department 10

Step 6 Insert, delete, or modify etc. date Computer Sciences Department 11

Create a form example Computer Sciences Department 12

PHP 5 Form Handling When the user fills out the form.and clicks the submit button, the form data is sent for processing to a PHP file named?????????.php". The form data is sent with the HTTP POST method. Computer Sciences Department 13

Step 7 create a form <form action="insert.php" method="post"> ID: <input type="text" name="id"> Name: <input type="text" name="name"> Date: <input type="text" name="date"> <input type="submit"> </form> Computer Sciences Department 14

GET vs. POST Both GET and POST create an array (e.g. array( key => value, key2 => value2, key3 => value3,...)). This array holds key/value pairs, where keys are the names of the form controls and values are the input data from the user. $_GET is an array of variables passed to the current script via the URL parameters. $_POST is an array of variables passed to the current script via the HTTP POST method Computer Sciences Department 15

When to use GET? Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send. The limitation is about 2000 characters. However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases. GET may be used for sending non-sensitive data. Note: GET should NEVER be used for sending passwords or other sensitive information! Computer Sciences Department 16

Step 8 Create & Check connection with Database $user = 'root'; $pass = ''; $db = 'db_test'; $hostname = 'localhost'; // Create connection $con=mysqli_connect($hostname,$user, $pass, $db); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to DataBase: ". mysqli_connect_error(); } Computer Sciences Department 17

When to use POST? Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send. Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server. However, because the variables are not displayed in the URL, it is not possible to bookmark the page. Computer Sciences Department 18

PHP 5 Form Validation Explanation Computer Sciences Department 19

PHP 5 Forms - Required Fields When some fields cannot be empty and must be filled out in the HTML form. if (empty($_post["name"])) { $nameerr = "Name is required"; } else { $name = test_input($_post["name"]); } Example Computer Sciences Department 20

Insert, select, delete, update data Computer Sciences Department 21

Computer Sciences Department 22

Computer Sciences Department 23

PHP Select Data From MySQL The SELECT statement is used to select data from one or more tables SELECT column_name(s) FROM table_name or we can use the * character to select ALL columns from a table: SELECT * FROM table_name Computer Sciences Department 24

Computer Sciences Department 25

PHP Delete Data From MySQL The DELETE statement is used to delete records from a table DELETE FROM table_name WHERE some_column = some_value Computer Sciences Department 26

Computer Sciences Department 27

PHP Update Data in MySQL The UPDATE statement is used to update existing records in a table UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Computer Sciences Department 28

Computer Sciences Department 29