PHP and MySQL PHP for the Web, page 333-378. PHP and MySQL MySQL Resource PHP – MySQL Resource

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

PHP and MySQL Database. Connecting to MySQL Note: you need to make sure that you have MySQL software properly installed on your computer before you attempt.
E-Invoice System CS541 Database Systems Class Project By: Parul Gupta.
What is it? –Large Web sites that support commercial use cannot be written by hand What you’re going to learn –How a Web server and a database can be used.
Multiple Tiers in Action
Website Development & Management PHP Odds & Ends Instructor: John Seydel, Ph.D. CIT Fall
Website Development Working with MySQL. What you will achieve today! Connecting to mySql Creating tables in mySql Saving data on a server using mySql.
Database Basics CS Why use a database?  powerful: can search it, filter data, combine data from multiple sources  fast: can search/filter a database.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
PHP-MySQL By Jonathan Foss. PHP and MySQL Server Web Browser Apache PHP file PHP MySQL Client Recall the PHP architecture PHP can communicate with a MySQL.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
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.
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
Internet Applications Spring Review Last week –MySQL –Questions?
Class 3 MySQL Robert Mudge Reference:
1 Chapter 8 – Working with Databases spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
INTERNET APPLICATION DEVELOPMENT For More visit:
PC SHOP by: Hussein Zahr ECE 3553: Multifarious Final Project.
PHP – MySQL Extensions. Table used in most examples CREATE TABLE product ( rowID INT NOT NULL AUTO_INCREMENT, productid VARCHAR(8) NOT NULL, name VARCHAR(25)
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
Website Development & Management Getting Started with Databases Instructor: John Seydel, Ph.D. CIT Fall
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.
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
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.
1. Connecting database from PHP 2. Sending query 3. Fetching data 4. Persistent connections 5. Best practices.
Lecture 10 – MYSQL and PHP (Part 2)
Database Access with PHP and MySQL CS356 Examples from Web Database Applications, by Hugh E. Williams & David Lane, O'Reilly, 2002.
PHP+MySQL Integration. Connecting to databases One of the most common tasks when working with dynamic webpages is connecting to a database which holds.
Session 7: Getting PHP to Talk to MySQL. Objectives Connecting to the Database Building & Executing the SQL SELECT Query Fetching & Displaying the data.
HTML, PHP, and MySQL: Putting It All Together. Making a Form Input tags Types: “text” “radio” “checkboxes” “submit”
CISC 3140 (CIS 20.2) Design & Implementation of Software Application II Instructor : M. Meyer Address: Course Page:
Intro to LAMP Programming Presented for SAT Linux Users' Group by Dan Zollars.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
PHP Database Processing CIS 1715 Web Technologies.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
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.
Accessing mySQL relational database. MySQL database.  Today, we will attempt and open a connection to the MySQL server.  We need to specify the database.
 Connectivity Function :-  mysql_connect ()  mysql_select_db ()  mysql_query ()  mysql_nam_rows ()  mysql_fetch_row ()  mysql_affected_rows () 
Windows 7 WampServer 2.1 MySQL PHP 5.3 Script Apache Server User Record or Select Media Upload to Internet Return URL Forward URL Create.
Server-Side Solutions Steve Perry
CSC 405: Web Application Engineering II8.1 Web programming using PHP What have we learnt? What have we learnt? Underlying technologies of database supported.
MySQL MySQL and PHP – interacting with a database.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
How Web Database Architectures Work CPS181s April 8, 2003.
PHP MySQL1 PHP and MySQL After this lecture, you should be able to:  Access a MySQL database with PHP  mysql_connect()  mysql_select_db()  mysql_query()
Setting up a Development Environment. What you need Webserver (Apache) Database (MySQL) PHP All in Uniserver (google “uniserver”) Download the windows.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 8 – Review Reference:
PHP using MySQL Database for Web Development (part II)
Remote hosts and web servers
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Introduction to PHP Part 1
Server-Side Application and Data Management IT IS 3105 (FALL 2009)
Advanced Internet Development Dynamic Web pages with php and MySQL
PHP: Output Formatting
PHP: Combo box FdSc Module 109 Server side scripting and
Tutorial 6 PHP & MySQL Li Xu
MySQL Web Application Connecting to a MySQL database
PHP AND MYSQL.
Database Access with PHP and MySQL
Presentation transcript:

PHP and MySQL PHP for the Web, page

PHP and MySQL MySQL Resource PHP – MySQL Resource Google “MySQL Create table” Google “PHP MySQL how to connect?”

MySQL Database server that is “almost free” Integrated into Apache Web Server and PHP PHP has many functions that can be used to interact with a MySQL server – Connect to a server – Query a server – Process query results

PHP: How to connect to a MySQL Server $link = mysql_connect( server, user, password); mysql_select_db(database_name, $link); mysql_connect return a “resource” A resource is a special variable type, holding a reference to an external resource.

Resources in PHP

PHP: How to run a query $link = mysql_connect( server, user, password); mysql_select_db(database, $link); $result = mysql_query(“SELECT * FROM table”); mysql_query returns a “resource” In this case $result is a link to a mysql resource.

PHP: mysql_fetch_array $q = “SELECT fname, lname FROM people WHERE userid = 65”; $result = mysql_query($q); $row = mysql_fetch_array($result); echo $row[‘fname’]. “ ”. $row[‘lname’]; Typically a query returns a table (a collection of rows). This query return one row.

PHP: mysql_fetch_array $q = “SELECT fname, lname FROM people”; $result = mysql_query($q); $row = mysql_fetch_array($result); echo $row[‘fname’]. “ ”. $row[‘lname’]; This query returns more than one row. We only print the fname and lname of the first returned row

PHP: mysql_fetch_array $q = “SELECT fname, lname FROM people”; $result = mysql_query($q); while ( $row = mysql_fetch_array($result) ) echo $row[‘fname’]. “ ”. $row[‘lname’]; mysql_fetch_array return null when it reaches the end of query results PHP interprets null as false

PHP: How to get query results