PDO Revisited MIS 3502 Jeremy Shafer Department of MIS

Slides:



Advertisements
Similar presentations
Day 9. SELECT INSERT UPDATE DELETE » The standard UPDATE statement. UPDATE table SET field1=val1, field2=val2 WHERE condition » Multiple table UPDATE.
Advertisements

Basic SQL Introduction Presented by: Madhuri Bhogadi.
Keys, Referential Integrity and PHP One to Many on the Web.
Agenda Journalling More Embedded SQL. Journalling.
PDO, PHP Data Object Use a Database with PHP
Learningcomputer.com SQL Server 2008 – Introduction to Transact SQL.
Python MySQL Database Access
Creating PHPs to Insert, Update, and Delete Data CS 320.
ADO.NET Data Access. Page  2 SQL  When we interact with the datasource through ADO.NET we use the SQL language to retrieve,modify,update information.
SQL Basic. What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database.
SQL.. AN OVERVIEW lecture3 1. Overview of SQL 2  Query: allow questions to be asked of the data and display only the information required. It can include.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Class11 Introduction to relational databases and MySQL MIS 3501, Fall 2015 Brad Greenwood, PhD MBA Department of MIS Fox School of Business Temple University.
Advanced Databases More Advanced PL/SQL Programing 1.
Class03 Introduction to Web Development (Hierarchy and the IDE) MIS 3501, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University.
Class02 More Arrays MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 1/14/2016.
PDOStatement Named Placeholders CIT336 - Connor Wiseman cit336.saveandquit.net/presentation.
1 Inside Module 3 Working with Eloquence Page n Commands to access Eloquence databases2 n Opening and closing a database3 n Eloquence and Base Command4.
Sessions and cookies MIS 3501, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 4/12/2016.
PDO Database Connections MIS 3501, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 3/8/2016.
PDO Database Connections
Class03 Introduction to Web Development (Hierarchy and the IDE)
Brad N Greenwood, PhD MBA
Sessions and cookies MIS 3501 Jeremy Shafer Department of MIS
Form Data (part 2) MIS 3502, Fall 2015 Jeremy Shafer Department of MIS
Introduction to web development concepts
Class06 Arrays MIS 3502 Jeremy Shafer Department of MIS
PHP: includes MIS 3501 Jeremy Shafer Department of MIS
Sessions and cookies (part 2)
jQuery – Form Validation
Form Data (part 1) MIS 3502, Fall 2015 Jeremy Shafer Department of MIS
Class07 PHP: loops and includes
PDO Database Connections
How to get data from a form
PHP Functions, Scope MIS 3501, Fall 2015 Jeremy Shafer
PDO Database Connections: Getting data out of the database
PHP-language, database-programming
ISC440: Web Programming 2 Server-side Scripting PHP 3
Arrays MIS 3502 Jeremy Shafer Department of MIS Fox School of Business
PDO Database Connections: Getting data out of the database
Form Data (part 2) MIS 3501 Jeremy Shafer Department of MIS
PDO Database Connections
PL/SQL Programing : Triggers
Organize your code with MVC
Introduction to relational databases and MySQL
Sessions and cookies (part 1)
PDO Database Connections
Form Data (part 2) MIS 3501 Jeremy Shafer Department of MIS
Class07 PHP: loops MIS 3501 Jeremy Shafer Department of MIS
Developing a Model-View-Controller Component for Joomla Part 3
Class05 How to get data from a form
MySQL Backup, Transfer and Restore
HTML5 APIs MIS3502 Jeremy Shafer Department of MIS
SQL .. An overview lecture3.
Sending a text message (and more)
JavaScript and the DOM MIS 2402 Jeremy Shafer Department of MIS
Sessions and cookies MIS 3501 Jeremy Shafer Department of MIS
Programming Control Structures with JavaScript Part 2
Class11 Introduction to relational databases and MySQL
Getting started with jQuery
Loops and Arrays in JavaScript
Form Data (part 1) MIS3501 Jeremy Shafer Department of MIS
Introduction to MIS3502 MIS 3502 Jeremy Shafer Department of MIS
MVC – Model View Controller
PDO and Arrays MIS 3502 Jeremy Shafer Department of MIS
Programming Control Structures with JavaScript
Updating Databases With Open SQL
Ajax and JSON Jeremy Shafer Department of MIS Fox School of Business
Updating Databases With Open SQL
Presentation transcript:

PDO Revisited MIS 3502 Jeremy Shafer Department of MIS Fox School of Business Temple University

Roadmap We are here.

Agenda Old business New business Review code which opens a PDO database connection Review the PDO methods – prepare, bindvalue, execute, fetch, fetchAll, closecursor Review sample code which executes SELECT, INSERT, UPDATE and DELETE statements New business A tip for managing errors An alternative to named placeholders The lastInsertId method

Opening a database connection The syntax for executing a method of any object $objectName->methodName(argumentList) What’s the meaning of this?

What’s the purpose of this line? Tip! What’s the purpose of this line?

Remember the order: prepare bindValue Execute

Using the question mark placeholder instead of a named placeholder. Tip! Using the question mark placeholder instead of a named placeholder.

Retrieves one database record as a one dimensional array. SELECT Retrieves one database record as a one dimensional array. Remember the order: prepare bindValue execute fetch closeCursor

Retrieves multiple database records as a two dimensional array. Remember the order: prepare bindValue execute fetchAll closeCursor

Can be hard to read…

Slightly easier to read…

INSERT Tip!

UPDATE

DELETE

Let’s see what we can build…