FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)

Slides:



Advertisements
Similar presentations
PHP: Date() Function The PHP date() function formats a timestamp to a more readable date and time.
Advertisements

PHP II Interacting with Database Data. The whole idea of a database-driven website is to enable the content of the site to reside in a database, and to.
CHAPTER 3 MORE ON FORM HANDLING INCLUDING MULTIPLE FILES WRITING FUNCTIONS.
WaveMaker Visual AJAX Studio 4.0 Training
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
PRACTICAL PHP AND MYSQL WALKTHROUGH USING SAMPLE CODES – MAX NG.
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
Introduction to Oracle9i: SQL1 Selected Single-Row Functions.
Tutorial 11 Working with Operators and Expressions
Tutorial 14 Working with Forms and Regular Expressions.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
Chapter 4 Handling User Input PHP Programming with MySQL 2nd Edition
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Internet and Web Application Development Revision.
Tutorial 14 Working with Forms and Regular Expressions.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Active Server Pages ASP is Microsoft’s server-side script engine for dynamically-generated web pages. Most common language used is VBScript. If you use.
PHP meets MySQL.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL.
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.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Oracle 11g: SQL Chapter 10 Selected Single-Row Functions.
Creating PHPs to Insert, Update, and Delete Data CS 320.
PHP Form Introduction Getting User Information Text Input.
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.
SQL Fundamentals  SQL: Structured Query Language is a simple and powerful language used to create, access, and manipulate data and structure in the database.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
DT228/3 Web Development Databases. Querying a database: Partial info Search engines, on-line catalogues often need to allow user to search a database.
IFS Intro to Data Management Chapter 5 Getting More Than Simple Columns.
הרצאה 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.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Tutorial 11 1 JavaScript Operators and Expressions.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
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,
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Web Database Programming Using PHP
Databases.
Introduction to Dynamic Web Programming
Open Source Server Side Scripting MySQL Functions
Chapter 10 Selected Single-Row Functions Oracle 10g: SQL
Web Database Programming Using PHP
Unix System Administration
PHP Introduction.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Web Systems Development (CSC-215)
Web DB Programming: PHP
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
Tutorial 6 PHP & MySQL Li Xu
Presentation transcript:

FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)

Canned String Functions Concatenate Length of a string Removing leading or trailing spaces Finding string substrings Transform string to upper or lower case Reversing a string Insert a substring into a string Right or left padding of a string with a character Etc.

Canned Numerical Functions Round Truncate Absolute value Square root Random value Etc.

Dates and Times Now – local date and time from clock Current timestamp Currant date Current time Extract second, minute, hour, etc.,, from a date Formatting dates Adding intervals to dates Subtract intervals from dates Returning elapsed period length Etc.

Specialized Functions IF (testing an expression for true) IFNULL (test two expressions and return first or second based on which is non-null) COALESCE (test a list of expressions and return first non- null)

Two ways to use SQL with an Application Dynamic SQL Embedded SQL Making calls to an SQL based DB

Dynamic SQL SQL code can be generated at runtime based on conditions found by the Host application In particular, to create the appropriate WHERE clauses The SQL code is put into a Host application string variable You can use dynamic SQL within a stored procedure

EMBEDDED SQL SQL is placed inside Host application code The SQL is processed in a first compilation phase SQL application uses cursors and INTO statements to pass values to Host application

Connecting to a DB PHP: mysqli (the i is for improved) or PDO (PHP Data Objects) Java: there are a set of drivers for the various relational databases, including MySQL The JDBC drivers are very popular and a lot of GUIs use them.NET driver

Protecting a MySQL DB Create and delete databases Grant specific access rights to groups of users Insert, Delete, Select rights on databases Administration and other users You can limit a user to access a DB only from a certain IP address Separate access rights for altering a schema Create DBs Add tables Change tables Create views Create indices Create triggers

PHP and MySQL

Continued

Please install… PHPStorm – for working with PHP RubyMine – for Ruby on Rails MVC framework Intellij IDEA – for Grails MVC framework

PHPStorm & Textbook’s examples Please install PHPStorm Go to ervlet?file=phps_allfiles.zip ervlet?file=phps_allfiles.zip Login Download zip file Open PHP_allfiles Make the guitar shop db Put the project under the xampp (or other) doc root Run

PHP & Textbook, continued Open the index file with PHPStorm See page 17 of text See HTML See link tag for the CSS file See the sets of label and input tags that create input boxes Notice content, data, and buttons in the div tags, which are part of the CSS code Open main.css with PHPStorm, to see CSS

The PHP File Open display_discount.php file with PHPStorm Notice that The PHP retrieves values from text box, product description, list price, and discount price ($_POST is an array) This is a built in array The http POST method is defined in the previous html page The PHP code calculates the Discount Notice that PHP is converting strings to integers The bottom part of the PHP file uses PHP echo commands to display the values

Example: PHP embedded in HTML <?php // get the data from the request $first_name = $_GET['first_name']; $last_name = $_GET['last_name']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional...> Name Test <link rel="stylesheet" type="text/css" href="main.css"/> Welcome First name: Last name: