CCT395, Week 8 Databases and Documents This presentation is licensed under Creative Commons Attribution License, v. 3.0. To view a copy of this license,

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.
U:/msu/course/cse/103 Day 23, Slide 1 Review of Day 22 What query did you use to search for an actor by name? –Return matches.
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
1 Open Source Programming. -Introduction to PHP -PHP installation /wamp server installation for PHP environment -PHP syntax -PHP variables -PHP Strings.
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
Amber Annett David Bell October 13 th, What will happen What is this business about personal web pages? Designated location of your own web page.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Multifarious Project Team Members Alberto Dominguez Nirmit Gang Jimmy Garcia Javier Handal.
Python CGI programming
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building Assignment.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Intro to LAMP Programming Presented for CIS Faculty at SAC by Dan Zollars.
Technology & Management Club Development Software Overview.
PHP with MySQL 1.
Website Development with PHP and MySQL Saving Data.
NUS.SOC.CS Roger Zimmermann Project Create a DASH-compliant (Dynamic Adaptive Streaming over HTTP) streaming system Logistics: Week 8.
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Retrieving data from MySQL using PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
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.
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.
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.
Clusterpoint Margarita Sudņika ms RDBMS & NoSQL Databases & tables → Document stores Columns, rows → Schemaless documents Scales UP → Scales UP.
Unit 1 – Web Concepts Instructor: Brent Presley.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
1/7/2016www.infocampus.co.in1. 1/7/2016www.infocampus.co.in2 Web Development training gives you and all-round training in both the design and the development.
ITX2000 Remote hosts and web servers Prof. Xiaohong (Sharon) Gao Room: T125 Ext: Week 8 – Review Reference:
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
Welcome to INF1343! Database Modeling and Database Design This presentation is licensed under Creative Commons Attribution License, v To view a copy.
CCT395, Week 4 Database Design and ER Modeling This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT395, Week 12 Storage, Grid Computing, Review This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
INF1343, Week 6 Implementing a Database with SQL This presentation is licensed under Creative Commons Attribution License, v To view a copy of this.
CCT395, Week 11 Review, Permissions Physical Storage and Performance This presentation is licensed under Creative Commons Attribution License, v. 3.0.
CCT395, Week 6 Implementing a Database with SQL and a Case Study Exercise This presentation is licensed under Creative Commons Attribution License, v.
CCT395, Week 2 Introduction to SQL Yuri Takhteyev September 15, 2010
INF1343, Winter 2012 Data Modeling and Database Design Yuri Takhteyev Faculty of Information University of Toronto This presentation is licensed under.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT396, Fall 2011 Database Design and Implementation Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
CCT395, Week 5 Translating ER into Relations; Normalization This presentation is licensed under Creative Commons Attribution License, v To view a.
CCT395, Week 7 SQL with PHP This presentation is licensed under Creative Commons Attribution License, v To view a copy of this license, visit
INF1343, Winter 2011 Data Modeling and Database Design Yuri Takhteyev University of Toronto This presentation is licensed under Creative Commons Attribution.
Data Modeling and Database Design
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Review Databases and Objects
CS320 Web and Internet Programming SQL and MySQL
Special Topics in CCIT: Databases
CCT1343, Week 2 Single-Table SQL Yuri Takhteyev University of Toronto
Software Quality Assurance
Database Design and Implementation
Data Modeling and Database Design
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
Database Design and Implementation
PHP / MySQL Introduction
Data Modeling and Database Design INF1343, Winter 2012 Yuri Takhteyev
The Re3gistry software and the INSPIRE Registry
CS3220 Web and Internet Programming SQL and MySQL
Presentation transcript:

CCT395, Week 8 Databases and Documents This presentation is licensed under Creative Commons Attribution License, v To view a copy of this license, visit This presentation incorporates images from the Crystal Clear icon collection by Everaldo Coelho, available under LGPL from Yuri Takhteyev University of Toronto October 27, 2010

Assignment 2

comment text time item time type access filename text user password name age gender user posted item comment refers to item user posted comment user1 designated as friend user2 user1 is confirmed friend of user2

to be continued

The Project ● Groups of up to 3 students ● Same amount of work regardless of size ● me if you cannot find a group

The Project ● 5-10 entities / tables ● A little simpler than Madame Z’s database ● A simple PHP front-end

The Project ● Proposal due on November 3 ● A list of group members ● A functional specification (be clear what is out of scope) ● An ER diagram ● Who is going to do what and when

PHP <?php $count=17; echo $count; ?> monkeys are happy. 17 monkeys are happy.

PHP and MySQL <?php $connection = mysql_connect("localhost", "kenobio", "th3f0rc3"); mysql_select_db("kenobio", $connection); $query = "select count(*) from monkeys where mood='H'"; $result = mysql_query($query); $row = mysql_fetch_array($result); echo $row['count(*)']; echo " monkeys are happy."; ?>

GET Parameters Monkeys with mood "<?php echo $_GET["mood"]; ?>": Monkeys with mood "H": Monkeys with mood "H":

GET Parameters $desired_mood = $_GET["mood"]; echo "Monkeys with mood '". $desired_mood. "': "; $query = "select * from monkeys"; $result = mysql_query($query); $count = 0; while($row = mysql_fetch_array($result)) { if ($row['mood']==$desired_mood) { $count = $count + 1; echo $row['name']. " "; } echo "Count: ". $count;

Dynamic SQL $desired_mood = $_GET["mood"]; echo "Monkeys with mood '". $desired_mood. "': "; $query = "select * from monkeys where mood='". $desired_mood. "'"; $result = mysql_query($query); $count = 0; while($row = mysql_fetch_array($result)) { $count = $count + 1; echo $row['name']. " "; } echo "Count: ". $count; Don’t do this!

Dynamic SQL $desired_mood = $_GET["mood"]; if ($desired_mood!="H" and $desired_mood!="S") { die ("Illegal mood"); } echo "Monkeys with mood '". $desired_mood. "': "; $query = "select * from monkeys where mood='". $desired_mood. "'"; $result = mysql_query($query); $count = 0; while($row = mysql_fetch_array($result)) { $count = $count + 1; echo $row['name']. " "; } echo "Count: ". $count;

HTML Forms Please select mood:

Menagerie Web Get the files: Edit the files: Change the username and the password, Do not make any other changes yet. Software for Editing: A “code editor” with syntax highlighting Notepad++ for Windows TextWrangler for Mac Gedit for Linux

Menagerie Web Put them in your ~/public_html/: Mac: cd menagerie-web/* scp * Windows: use WinSCP: Set permissions (on the server!): cd ~/public_html ls chmod a+r *.html chmod a+rx *.php See if it's working:

Troubleshooting Check that you: - changed the username and password - made no other changes to the files - copied the files (check that they are there using “ls”!) - set the permissions Once you start making changes: - make them in small steps - keep the previous version that you know works!

PHPMyAdmin

Documents Onto this week's topic:

pg

name: Barack Hussein Obama II date_of_birth: August 4, 1961 sex: male location: Honolulu mother: Stanley Ann Dunham father: Barack Hussein Obama hour_of_birth: 7:24 pm... Digital

Esso.jpg

Full Text Search Matching sub-strings Can be done with LIKE Bag-of-words search Like doing LIKE for every term – very slow without a proper index! Natural language search Stop words (“the”, “of”, “to”, “end”) Stemming (“monkey” vs “monkeys”) Synonyms (“monkey” vs “simian” vs “Affe”) Ranking Repeated used many times, rare words Can be useful. SQL support is coming.

AliceBob invoice payment order

AliceBob payment invoice (HTML) order

AliceBob

AliceBob invoice payment order machine-readable documents

Bills Microdevices Spring St. 413 Elgin IL Joes Office Supply Lakeshore Dr 32 W. Chicago IL XML Example.xml

Pencils, box #2 red XML

Pencils, box #2 red XML Anatomy

Pencils, box #2 red XML Anatomy

Validation Syntactic: form 12.50</Amount Semantic: meaning Male

Bills Microdevices Spring St. 413 Elgin IL Namespaces

XML and RDBMS Externalization: export, import, messaging Internal use: XML storage and retrieval (less common for now)

AliceBob application software (e.g., using PHP) database HTML

AliceBob application software (e.g., using PHP) database HTTP request HTTP request HTML SQL

AliceBob application software (e.g., using PHP) database HTTP request HTTP request HTML SQL

AliceBob application software (e.g., using PHP) database HTTP request HTTP request HTML XML SQL

Bob application software (e.g., using PHP) database HTTP request HTTP request HTML XML SQL Alice Inc. “Web services”, “APIs”, “REST”, “Semantic web,” “Service-oriented architecture”

Examples Twitter: vs.

Examples Yahoo! Geocoding API: %2C+Mississauga%2C+ON vs. appid=YD- 9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA-- &street=3359+Mississauga+Rd+N&city=Mississauga &state=ON&country=Canada

Mississauga Rd Mississauga ON L5L CA

<Result precision="address" warning="The exact location could not be found..."> Mississauga Rd Mississauga ON L5L CA

Examples Geonames Web Service north=45&south=42&east=-78&west=-82

en Toronto Toronto (, local pronunciation ) is the largest city in Canada[ Canada], Greenwich Mean Time. Retrieved on and is the provincial capital of Ontario. It is located on the northwestern shore of Lake Ontario.[ cities/Toronto.html Toronto, Ontario, Canada, North America] Retrieved on With over 2 (...) /thumb jpg

Alternatives JSON formatted=true&north=45&south=42 &east=-78&west=-82

{"geonames": [ { "summary": "Toronto (, local pronunciation ) is the largest city in Canada[ Canada], Greenwich Mean Time. Retrieved on and is the provincial capital of Ontario. It is located on the northwestern shore of Lake Ontario.[ cities/Toronto.html Toronto, Ontario, Canada, North America] Retrieved on With over 2 (...)", "title": "Toronto", "wikipediaUrl": "en.wikipedia.org/wiki/Toronto", "elevation": 0, "countryCode": " ", "lng": , "feature": "", "thumbnailImg": " jpg", "lang": "en", "lat": 43.65, "population": 0 },

Examples Yahoo! Geocoding API: %2C+Mississauga%2C+ON vs. appid=YD- 9G7bey8_JXxQP6rxl.fBFGgCdNjoDMACQA-- &street=3359+Mississauga+Rd+N&city=Mississauga &state=ON&country=Canada

JSON [{"place":null,"geo":null,"truncated":false,"in_reply _to_status_id_str":null,"in_reply_to_status_id":null, "favorited":false,"in_reply_to_user_id_str":null,"sou rce":"web","contributors":null,"in_reply_to_screen_na me":null,"created_at":"Tue Oct 26 16:01: ","retweet_count":null,"in_reply_to_user_id":null,"user":{"statuses_count":1491,"description":"grafia","show_all_inline_media":false,"profile_use_backgroun d_image":true,"favourites_count":57,"followers_count" :124,"contributors_enabled":false,"notifications":nul l,"profile_background_color":"0c3bf5","geo_enabled":f alse,"profile_background_image_url":" g.com\/profile_background_images\/ \/tumblr_l 8hz3wJ5lK1qb7u0po1_400.gif","profile_text_color":"eb1 725","url":" eras","verified":false,"profile_background_tile":true,"follow_request_sent":null,"lang":"en","created_at": "Fri Jun 26 03:54: ","profile_link_color":"0fc3ff","location":"Brasi l","protected":false,"profile_image_url":" _C_pia_normal.JPG",

JSON [{"place":null,"geo":null,"truncated":false,"in_reply_to_status_id_ str":null,"in_reply_to_status_id":null,"favorited":false,"in_reply_ to_user_id_str":null,"source":"web","contributors":null,"in_reply_t o_screen_name":null,"created_at":"Tue Oct 26 16:01: ","retweet_count":null,"in_reply_to_user_id":null,"user":{"stat uses_count":1491,"description":"grafia","show_all_inline_media":fal se,"profile_use_background_image":true,"favourites_count":57,"follo wers_count":124,"contributors_enabled":false,"notifications":null," profile_background_color":"0c3bf5","geo_enabled":false,"profile_bac kground_image_url":" s\/ \/tumblr_l8hz3wJ5lK1qb7u0po1_400.gif","profile_text_col or":"eb1725","url":" "verified":false,"profile_background_tile":true,"follow_request_sen t":null,"lang":"en","created_at":"Fri Jun 26 03:54: ","profile_link_color":"0fc3ff","location":"Brasil","protected" :false,"profile_image_url":" \/P _-_C_pia_normal.JPG",

More PHPMyAdmin

1 H Betsy 5 2 S Boris 2 4 H Miss M 9 XML

1: monkey_id: 1 mood: H name: Betsy bananas_eaten: 5 2: monkey_id: 2 mood: S name: Boris bananas_eaten: 2 3: monkey_id: 4 mood: H name: Miss M bananas_eaten: 9 4: monkey_id: 5 mood: S name: Bob bananas_eaten: 2 YAML

SQL Support in RDBMS Direct XML export mysql -p --xml -e "use menagerie; select * from pet;" mysqldump --xml kenobio monkeys -p Direct XML import LOAD XML command in MySQL 6.0.3, but we are using 5.0. (Meanwhile, one can use a stored procedure.) Storing XML as a datatype Available in some systems, but not in MySQL currently. (Meanwhile, you can store XML a BLOB.)

Questions?