NMD202 Web Scripting Week5. What we will cover today PHPmyAdmin Debugging – using print_r Modifying Data PHP (cont.) 4D Methodology File and IO operations.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
NMD202 Web Scripting Week3. What we will cover today Assignment 1 Database Concepts MySQL Exercises Server side validation Exercises.
Project Implementation for COSC 5050 Distributed Database Applications Lab6.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Application Sketch home.htm delete.php updateform.php display.php insert.php insertform.htm update.php Data Base Hyperlink Information exchange with database.
Server-side Scripting Powering the webs favourite services.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Web Application Development. Define ER model in QSEE Generate SQL Create Database mySQL Write Script to use TableEditor class Process to create A simple.
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
Web Based Inventory Site Building Room Asset Number Category Type Description Serial Number Manufacturer Model Vendor Name Acquired Date P O Number Budget.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Using the Georgia Online Assessment System(OAS) We will lead the nation in improving student achievement. Kathy Cox, State Superintendent of Schools.
PHP meets MySQL.
Instructors begin using McGraw-Hill’s Homework Manager by creating a unique class Web site in the system. The Class Homepage becomes the entry point for.
Introduction to MySQL Lab no. 10 Advance Database Management System.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
Website Development with PHP and MySQL Saving Data.
Basic & Advanced Reporting in TIMSNT ** Part Two **
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Plant Accession Application Maintenance Manual. Accession Application Website Environment Overview WinHost.com ASP Pages VBScript Procs Constants Style.
ITCS373: Internet Technology Lecture 5: More HTML.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
CS 174: Web Programming August 31 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Creating PHPs to Insert, Update, and Delete Data CS 320.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
13. PHP: Insert, View Data. M. Udin Harun Al Rasyid, S.Kom, Ph.D Desain dan Pemrograman.
0 eCPIC Admin Training: OMB Submission Packages and Annual Submissions These training materials are owned by the Federal Government. They can be used or.
GOAL User Interactive Web Interface Update Pages by Club Officers Two Level of Authentication.
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
COMP3241 E-Commerce Technologies Richard Henson University of Worcester November 2014.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Database Access Control IST2101. Why Implementing User Authentication? Remove a lot of redundancies in duplicate inputs of database information – Your.
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.
Class 3Intro to Databases Class 4 Simple Example of a Database We’re going to build a simple example of a database, which will allow us to register users.
MySQL MySQL and PHP – interacting with a database.
Chapter 12© copyright Janson Industries Java Server Faces ▮ Explain the JSF framework ▮ SDO (service data objects) ▮ Facelets ▮ Pagecode classes.
PHP Form Processing * referenced from
NMD202 Web Scripting Week2. Web site
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
Day 22, Slide 1 CSE 103 Day 22 Non-students: Please logout by 10:12. Students:
PlanBuilder How-To.
Intro to WordPress (Using XAMPP)
BASIC PHP and MYSQL Edward S. Flores.
REDCap Data Migration from CSV file
MySQL and PHPMyAdmin 1.
Presentation transcript:

NMD202 Web Scripting Week5

What we will cover today PHPmyAdmin Debugging – using print_r Modifying Data PHP (cont.) 4D Methodology File and IO operations Exercises

PHPmyAdmin MySQL has a lot of clients with GUI. phpMyAdmin is an open source tool written in PHP intended to handle the administration of MySQL over the web.

PHPmyAdmin Setup: Copy the phpMyAdmin (in Xampp root folder) to document folder (xampp/htdocs) Access it through the browser:

Debug Using print_r print_r - Prints human-readable information about a variable

Debug Using print_r: $a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z')); echo “ ”; print_r ($a); echo “ ”; Array ( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z )

Sanitize queries mysql_real_escape_string() This function must always be used to make data safe before sending a query to MySQL. $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'", mysql_real_escape_string($user), mysql_real_escape_string($password));

Redirection There are several ways to perform page redirection in PHP The most common way is to send a special header to the browser: header(‘Location:page.php’); Headers must be sent before any information is sent to the browser, this includes any white spaces, make sure you open the php script tag in the first line of your document otherwise you will get the following error: Warning: Cannot modify header information - headers already sent by

Ini Files Ini files are special files where you include configuration information for your application, if you are know *nix system you are used to this format: ; This is a sample configuration file ;Comments start with ';', as in php.ini [database] host = localhost username = root password = database = sampleDataBase $conf = parse_ini_file($filename) loads in the ini file specified in filename, and returns the settings in it in an associative array.

Modifying Data Insert Form: If form has been submitted then run the insert query (after validation) and provide feedback (optionally redirect the page to the List screen) Draw the form action attribute should be set to $_SERVER[‘PHP_SELF’]

Modifying Data Edit Form: ID of the record is passed in the querystring If form has been submitted then run the update query (after validation) and provide feedback (optionally redirect the page to the List screen) Draw the form with the values populated from query results Usually Insert and edit screen are integrated in the same PHP page

Modifying Data Deleting Data Id record to delete is passed through the querystring Query is built based on id (data should be sanitized) Query is performed Feedback is given to the user (optionally redirect to the list screen) Sometimes Delete is integrated in the list screen, using a querystring like ?task=delete&Id=25, before displaying the list record is deleted by testing if $_GET[‘task’]==“delete”

Exercise Build a complete set of screens to insert, update, display and delete the students records. On the display table insert two more columns with links to the delete and edit pages, providing the id of the record. Split the logical parts into separate php files: display.php, edit.php, insert.php, delete.php, configuration.ini Sanitize your data

Exercise Include more screens to manage student grades

4D methodology 4D Methodology is a variation of the waterfall methodology Is a methodology that allows you to understand the system you are trying to achieve, implement it and deliver it according to the needs of a client

4D methodology Define – Understand the requirement of the system Design – Design the system (ER Diagrams, page navigation diagrams, templates, page description) Develop – Implement and test the system Deploy – Deploy the system in the client infraestructure

4D methodology The most crucial steps in building any system is the Define and Design steps. Failure to do so will result in a large amount of time spent in the implementation.

4D methodology Page navigation diagram: Manage Users EditInsertList Admin Homepage Login

4D methodology Page description: General description of the page How does the user comes here, where does it go from here (include parameters in querystring, ie:edit page) Description form if any, including field labels, database field, validation rules, control type (textbox, selectbox etc) Business rules, ie: User can only be deleted if there is no records from that user.

File and IO operations PHP can handle all vulgar file operations including: Read Write Delete List files in folder Change attributes (*nix chmod) Etc

File and IO operations Read file: $filename can be a URL

File and IO operations Write file:

File and IO operations Error Handling:

Exercise Create a file in a special folder /gradeLogs (maybe accessible from the student list as a link) that generates a file (in a special folder) with the current students, and their grades ie, filename should be unique (use the date function to generate unique filenames): Luis Maths:14 Maths2: John:15 Create another screen where you can list the files in the folder and allow user to click and see the content file