Website Development Working with MySQL. What you will achieve today! Connecting to mySql Creating tables in mySql Saving data on a server using mySql.

Slides:



Advertisements
Similar presentations
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.
Advertisements

PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Widhy Hayuhardhika NP, S.Kom. Overview of database structure Connecting to MySQL database Selecting the database to use Using the require_once statement.
Website Development Working with Databases. What you will achieve today! Connecting to mySql Creating tables in mySql Saving data on a server using mySql.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
Website Development Registering Users – Introducing Cookies.
PHP and MySQL PHP for the Web, page PHP and MySQL MySQL Resource PHP – MySQL Resource
Objectives Connect to MySQL from PHP
Multiple Tiers in Action
MySQL and PHP By Trevor Adams.
Website Development & Management PHP Odds & Ends Instructor: John Seydel, Ph.D. CIT Fall
PHP and MySQL Web Development tMyn1 PHP and MySQL Web Development When you install PHP, you can select from a number of extensions. The MySQL support in.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
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,
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:
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)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Database Access Through the Web.
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.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
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.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
1. Connecting database from PHP 2. Sending query 3. Fetching data 4. Persistent connections 5. Best practices.
Lecture 10 – MYSQL and PHP (Part 2)
Accessing Your MySQL Database from the Web with PHP (Ch 11) 1.
Database Access with PHP and MySQL CS356 Examples from Web Database Applications, by Hugh E. Williams & David Lane, O'Reilly, 2002.
Website Development with PHP and MySQL Saving Data.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Analysis of SQL injection prevention using a filtering proxy server By: David Rowe Supervisor: Barry Irwin.
Web-Based Database Programming with PHP. Dept. of Computing Science, University of Aberdeen2 In this lecture you will learn PHP Basics PHP functions –To.
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:
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
PHP Database Processing CIS 1715 Web Technologies.
Security Considerations Steve Perry
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
PHP and SQL Server: Connection IST2101. Typical web application interaction (php, jsp…) database drivers 2IST210.
Connecting, Queries, Best Practices Tran Anh Tuan Edit from Telerik Software Academy
Chapter 8 Manipulating MySQL Databases with PHP PHP Programming with MySQL 2 nd Edition.
CSC 2720 Building Web Applications Accessing MySQL from PHP.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
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 AND MYSQL WORKBENCH MIS2502 Data Analytics.
1 PHP and MySQL Web Development When you install PHP, you can select from a number of extensions. The MySQL support in PHP consists of a number of functions.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
PHP Functions Besides the built-in PHP functions, we can create our own functions. A function is a block of statements that can be used repeatedly in.
Server-Side Application and Data Management IT IS 3105 (FALL 2009)
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
mysql and mysql workbench
Database Driven Websites
PHP-language, database-programming
MySQL Web Application Connecting to a MySQL database
Web Programming– UFCFB Lecture
MySQL Web Application Connecting to a MySQL database
Database Access with PHP and MySQL
Presentation transcript:

Website Development Working with MySQL

What you will achieve today! Connecting to mySql Creating tables in mySql Saving data on a server using mySql Getting data from the server using mySql

: Customer browser request service access page interpret set data present html return html get data databasescripting language web server Reminder of the general process today’s emphasis

Essential PHP functions

mysql_connect ([string hostname, string username [, string password]]]) Returns a positive MySQL link identifier on success, or an error message on failure. mysql_connect() establishes a connection to a MySQL server.

mysql_query (string query [, int link_identifier]) mysql_query() sends a query to the currently active database on the server that's associated with the specified link identifier. If link_identifier isn't specified, the last opened link is assumed. mysql_query() returns TRUE (non-zero) or FALSE to indicate whether or not the query succeeded. A return value of TRUE means that the query was legal and could be executed by the server. It does not indicate anything about the number of rows affected or returned. It is perfectly possible for a query to succeed but affect no rows or return no rows.

MyDBFunctions.php

array mysql_fetch_row (int result) Returns: An array that corresponds to the fetched row, or false if there are no more rows. mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0. Subsequent call to mysql_fetch_row() would return the next row in the result set, or false if there are no more rows.

mysql_num_rows (int result) mysql_num_rows() returns the number of rows in a result set. This command is only valid for SELECT statements. mysql_num_fields (int result) mysql_num_fields() returns the number of fields in a result set.

Now some SQL

CREATE TABLE ( col_name col_type,... )

CREATE TABLE DATEPERSON ( NAME TEXT, AGE INT, HOBBIES TEXT, TEXT, LIKES TEXT, HATES TEXT, POSTCODE TEXT, LOWERAGE INT, UPPERAGE INT )

test

DROP TABLE DATEPERSON DROP TABLE

test

INSERT INTO SET Col_name = value,...

INSERT INTO DATEPERSON SET NAME = “ROMEO", AGE = 14, HOBBIES = "maudling", = LIKES = "Mercutio", HATES = "Tibbalt", POSTCODE = "VE21 2BB", LOWERAGE = 14, UPPERAGE = 16

test

SELECT FROM WHERE,,...

SELECT * FROM DATEPERSON

test

Have a look at this Sample Database Application

What else? Forms for input – JavaScript validation? Forms for editing existing data Better error trapping An attractive interface – style sheets etc.

So what have we got now? Full database access Internet presentation In principle, most business applications can be served in this way