Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.

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.
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Web Database Programming Connecting Database to Web.
NMD202 Web Scripting Week5. What we will cover today PHPmyAdmin Debugging – using print_r Modifying Data PHP (cont.) 4D Methodology File and IO operations.
PHP and MySQL PHP for the Web, page PHP and MySQL MySQL Resource PHP – MySQL Resource
Intermediate PHP & MySQL
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
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.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Class 3 MySQL Robert Mudge Reference:
INTERNET APPLICATION DEVELOPMENT For More visit:
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
PHP MySQL Introduction
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
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.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Chapter 6 PHP Interacts with Mysql Database. Introduction In PHP, there is no consolidated interface. Instead, a set of library functions are provided.
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.
PHP Part 2.
Database and mySQL Week 07 Dynamic Web TCNJ Jean Chu.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Intro to DatabasesClass 4 SQL REVIEW To talk to the database, you have to use SQL SQL is used by many databases, not just MySQL. SQL stands for Structured.
CIS166AE : PHP Web Scripting Rob Loy. Tonight’s Agenda Housekeeping items Housekeeping items PHP basics PHP basics Student connection to server Student.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
Web Programming Language Week 7 Dr. Ken Cosh PHP and storage.
Information Building and Retrieval Using MySQL Track 3 : Basic Course in Database.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week.
Module Review Basic SQL commands: Create Database, Create Table, Insert and Select 2. Connect an SQL Database to PHP 3. Execute SQL Commands in.
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.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
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)
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
PHP: MySQL. PHP Connect to MySQL PHP 5 and later can work with a MySQL database using: – MySQLi extension (the "i" stands for improved) – PDO (PHP Data.
PHP Database Pemrograman Internet. PHP MySQL Database With PHP, you can connect to and manipulate databases. MySQL is the most popular database system.
CHAPTER 10 PHP MySQL Database
MySQL MySQL and PHP – interacting with a database.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
PHP & MY SQL Instructor: Monireh H. Sayadnavard 1.
PHP: MySQL Lecture 14 Kanida Sinmai
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CS320 Web and Internet Programming SQL and MySQL
Unix System Administration
Introduction to Web programming
ISC440: Web Programming 2 Server-side Scripting PHP 3
Web Systems Development (CSC-215)
PHP and MySQL.
Tutorial 6 PHP & MySQL Li Xu
CS3220 Web and Internet Programming SQL and MySQL
CS3220 Web and Internet Programming SQL and MySQL
Introduction to Web programming
Presentation transcript:

Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy

Agenda Homework Homework PHP/DB PHP/DB SQL SQL myDBAdmin myDBAdmin In Class work In Class work Presentations Presentations Lab Lab

Using mySCC Use your desktop credentials

Eclipse

IMPORTANT NOTE All filenames lower case alphanumeric names.

Hosting FTP Information: FTP Information: URL:.com URL:.com Login : sccstudent Login : sccstudent Password : Maricopa Password : Maricopa Folder : Folder :

Database Infrastructure

IMPORTANT NOTE A Database Server can not have a DB with the same name. Since we use ONE DB Server, all our DBs have to have unique names.

Database Structure (mySQL) mySQL is a database. mySQL is a database. Databases contain objects called tables. Databases contain objects called tables. A table is a collections of related data organized in columns and rows. A table is a collections of related data organized in columns and rows. Access to information is through SQL (Structured Query Language). Access to information is through SQL (Structured Query Language).

Steps to interact with DB 1. Connect to server 2. Connect to DB 3. Create SQL statement 4. Execute SQL > Create record object 5. Convert record object into array 6. Close connection

Information needed for DB Need server name/IP (e.g. mysql..com or localhost) Need server name/IP (e.g. mysql..com or localhost) Need username Need username Need password Need password Need DB name Need DB name Need table names Need table names Need column names Need column names

IMPORTANT NOTE SQL Commands (SELECT, INSERT, UPDATE, etc) are almost always written in CAPS and other pieces of a SQL statement are written as normal case.

PHP / mySQL Syntax // Connect to server $con = mysql_connect(“SERVER",“USER",“PASSWORD"); // Connect to DB mysql_select_db(“DATABASE", $con); // Execute SQL Query $result = mysql_query("SELECT * FROM TABLE"); // Close connection mysql_close($con);

PHP / mySQL Syntax // When query has information returned // need to hold the information for display $result = mysql_query("SELECT * FROM Persons"); // The RECORDSET will be an object (e.g. $result) // Need to break the object into an array (e.g. $row) while($row = mysql_fetch_assoc($result)) { // The WHILE runs until END OF RECORD echo $row['FirstName']. " ". $row['LastName‘]." "; }

Sample SQL Statements SELECT * FROM Persons; SELECT ‘FirstName’ FROM Persons WHERE AGE>30; INSERT INTO Persons (FirstName, LastName, Age) VALUES ('Peter', 'Griffin', '35'); UPDATE PERSONS ‘FirstName’=‘Peg’ WHERE id=5; Never do a DELETE statement, instead “archive” the date.

IMPORTANT NOTE The life cycle in PHP is the length of time it takes the server to find the file, process the information, and send the completed static HTML back to the client.

Connecting to your DB Server: mysql..com Server: mysql..com Username: sccstudent_ Username: sccstudent_ Password: Maricopa_ Password: Maricopa_ DB name: sccstudent_ DB name: sccstudent_ Table: week4 Table: week4 Columns: id, username, password, firstname, lastname, phone, , created Columns: id, username, password, firstname, lastname, phone, , created

phpMyAdmin

In class Display ALL results from DB/table Display ALL results from DB/table Web form for creating a new user id, created, username and password ONLY! Web form for creating a new user id, created, username and password ONLY! Web form for updating an existing user username and password ONLY! Web form for updating an existing user username and password ONLY!

Early Warning! No Class on Wednesday, November 23 (Day before Thanksgiving)

Questions?

Lab Update the web form created in class to allow the user to input first name, last name, phone, and address. Update the web form created in class to allow the user to input first name, last name, phone, and address. Send to with URL to input form file before 6pm on October 5. Send to with URL to input form file before 6pm on October

Homework Using the class work and lab work make the following updates… Using the class work and lab work make the following updates… Reject any creation where there are blank entries Reject any creation where there are blank entries Send to with URL to input form file before 6pm on October 5. Send to with URL to input form file before 6pm on October