Creating Databases for Web applications Making a table of SQL queries. PHP and other DBMSs. Rights. Left Join, etc. Homework: Make posting on Open Source.

Slides:



Advertisements
Similar presentations
How to Create a Local Collection
Advertisements

Relational Database Systems Higher Information Systems Advanced Implementation in MySQL/PHP.
Widhy Hayuhardhika NP, S.Kom. Overview of database structure Connecting to MySQL database Selecting the database to use Using the require_once statement.
Keys, Referential Integrity and PHP One to Many on the Web.
Concepts of Database Management Sixth Edition
Intermediate PHP & MySQL
A Guide to MySQL 7. 2 Objectives Understand, define, and drop views Recognize the benefits of using views Use a view to update data Grant and revoke users’
A Guide to SQL, Seventh Edition. Objectives Understand, create, and drop views Recognize the benefits of using views Grant and revoke user’s database.
CSC 2720 Building Web Applications Database and SQL.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
Phil Brewster  One of the first steps – identify the proper data types  Decide how data (in columns) should be stored and used.
CSCI 6962: Server-side Design and Programming
Databases with PHP A quick introduction. Y’all know SQL and Databases  You put data in  You get data out  You can do processing on it very easily 
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Database Lecture # 1 By Ubaid Ullah.
Chapter 9 SQL and RDBMS Part C. SQL Copyright 2005 Radian Publishing Co.
LIS651 lecture 7 PHP mySQL Thomas Krichel
Introduction –All information systems create, read, update and delete data. This data is stored in files and databases. Files are collections of similar.
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Creating Databases for Web Applications SQL Select extras Listing [names of] tables generalized display of recordset simple password handling php and other.
Chapter 4 The Relational Model 3: Advanced Topics Concepts of Database Management Seventh Edition.
PHP meets MySQL.
Constraints  Constraints are used to enforce rules at table level.  Constraints prevent the deletion of a table if there is dependencies.  The following.
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.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
CSC 2720 Building Web Applications Database and SQL.
1. Connecting database from PHP 2. Sending query 3. Fetching data 4. Persistent connections 5. Best practices.
Lecture 10 – MYSQL and PHP (Part 2)
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
10/17/2012ISC471/HCI571 Isabelle Bichindaritz 1 Technologies Databases.
PHP+MySQL Integration. Connecting to databases One of the most common tasks when working with dynamic webpages is connecting to a database which holds.
1 IT420: Database Management and Organization Database Security 5 April 2006 Adina Crăiniceanu
Chapter 6 Database Administration
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
Internet Information Systems Writing to Databases and Amending Data.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
Creating Databases Local storage. join & split Classwork: show 1 table application. Share designs for oscars application. Adaptive select. Homework: [Catch.
Creating Databases for web applications [Complete presentations] More SQL Class time: discuss final projects. Do posting if you have not done it.
2010/11 : [1]PHP with MySQLBuilding Web Applications using MySQL and PHP (W1) PHP with MySQL.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
Security Considerations Steve Perry
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.
DataFlow Diagram – Level 0
Information Systems Today: Managing in the Digital World TB3-1 3 Technology Briefing Database Management “Modern organizations are said to be drowning.
Creating databases for web applications Report on using sources, getting examples working. Retrieve information from database. Recordsets. Arrays. Loops.
>> PHP: MySQL & CRUD. R ecall Database Tables Records is composed of Operations (CRUD) Create Retrieve Update Delete DBMS Access Control MySQL phpMyAdmin.
Creating Databases for Web Applications 3-Tier. Design vs Function vs Content. More SQL. More php. Homework: work on final projects.
CSC 405: Web Application Engineering II8.1 Web programming using PHP What have we learnt? What have we learnt? Underlying technologies of database supported.
# 1# 1 QueriesQueries How do we ask questions of the data? What is SELECT? What is FROM? What is WHERE? What is a calculated field? Spring 2010 CS105.
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
SQL Injection Josh Mann. What is SQL Injection  SQL injection is a technique for exploiting web applications that use client-supplied data in SQL queries.
MySQL Tutorial. Databases A database is a container that groups together a series of tables within a single structure Each database can contain 1 or more.
Creating Databases for Web applications Making a table of table information. Reprise on database design. SQL. Classwork/Homework: Projects! Postings.
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Y.-H. Chen International College Ming-Chuan University Fall, 2004
Introduction to Web programming
SQL INJECTION ATTACKS.
Web Programming Week 3 Old Dominion University
Database systems Lecture 3 – SQL + CRUD
Web Programming Week 3 Old Dominion University
Relational Database Design
PHP AND MYSQL.
Web Programming Week 3 Old Dominion University
Presentation transcript:

Creating Databases for Web applications Making a table of SQL queries. PHP and other DBMSs. Rights. Left Join, etc. Homework: Make posting on Open Source versus Proprietary. Keep working on projects. Happy thanksgiving.

What are tables in given database Show table names <?php require("jeanine\quizphp\opendbq.php"); $query="show tables"; $rs=mysql_db_query($DBname, $query, $link); ?> Table names <? while ($row=mysql_fetch_array($rs)){ print(" "); print($row[0]); print(" "); } print(" "); ?>

result Table names catalog customers history ordereditems orders players questions

Show table names and field names <?php require("jeanine\quizphp\opendbq.php"); $query="show tables"; $rs=mysql_db_query($DBname, $query, $link); ?> Table names <? $i = 0; while ($row=mysql_fetch_array($rs)){ print(" "); $tablenames[$i] = $row[0]; $i++; print($row[0]); print(" "); } print(" ");

for ($j=0;$j<$i;$j++) { $query = "describe ".$tablenames[$j]; print (" ". $tablenames[$j]. " table \n "); print (" Field Type Null Key \n "); $rt=mysql_db_query($DBname,$query,$link); while ($fi=mysql_fetch_array($rt)) { print (" ". $fi['Field']. " \n "); print (" ".$fi['Type']. " \n "); print (" ".$fi['Null']. " \n "); print (" ".$fi['Key']. " \n "); print (" "); } print (" "); } ?>

Table of queries If you have a large set of fixed SQL queries, you may make a new table: iddescriptiontext 1final diagnosis when presenting signs of appendicitis Select final.diagnosis from final, initial where initial.temp > 100 AND initial.pain = 'left' AND final.caseno = initial.caseno 2initial potential ulcer cases Select * from initial where initial.pain = 'sharp' AND initial.temp < 100 ….

Present to user Pick selection: description final diagnosis when presenting signs of appendicitis initial potential ulcer cases Don't show the user the messy SQL

Produce responses Make the query the SQL corresponding to the user's choice. Display recordset in a table –Now, need generalized code that creates headings for tables and extracts names of fields 'on the fly' based on information in recordset. php: –mysql_fetch_field –mysql_fetch_array

Current Favorites <?php require("openfirstdb.php"); $query="Select * from favorites"; $result=mysql_db_query($DBname, $query, $link); $fieldnames= Array(); print (" "); $nf = mysql_num_fields($result); for ($i=0; $i<$nf;$i++) { $fieldobj= mysql_fetch_field($result); $fieldnames[$i]=$fieldobj->name; print (" ".$fieldnames[$i]." "); } print (" \n"); while ($row=mysql_fetch_array($result)) { print (" "); for ($i=0; $i<$nf; $i++) { print (" ".$row[$fieldnames[$i]]." "); } print(" "); } mysql_close($link); ?> first for loop to set up headers Second for loop, in while loop, to extract field data.

Note If you do [ever] show field names to your customers/clients/players/…, you need to make them longer/better/etc.

MySQL Rights Possible to limit rights to specific users. –specific table or whole database –SELECT, INSERT, DELETE, UPDATE, DROP, CREATE, ALTER NOTE: I don't know if your rights include right to use GRANT! Limiting rights is to prevent unintentional errors as much as / more than not trusting certain people. Your php code is main line of protection.

Left Join, etc. Searching for something that isn't there. –Left Join –NOT EXISTS. You can create (on the fly) a new table and check if it has any rows. –See vs-not-exists-vs-left-join-is-null-mysql/ vs-not-exists-vs-left-join-is-null-mysql/

php: checking for value Using isset($_GET['guess']) is better than using $guess if ($guess != null) { }

php: strpos Check if string is present in another string $n = strpos($answer,"SUNY"); if ($n>-1) { } Alternative to regular expression

php: explode Breaks up string into an array if $listofstuff is "orange,apple,peach" $list = explode(",",$listofstuff); produces $list = ["orange","apple","peach"];

Database administrator technical: working with software, including maintaining security, performance. Keeping aware of changes in products, new products. administrative: working with technical staff AND other staff specific business: knowing and keeping up-to-date with knowledge of this business.

Internationalization & Localization How to make the php MySQL application work in different places character sets (includes symbols, encodings for symbols, collations (ordering rules) error messages (MySQL). Presumably your php code does error handling, also. time zone way to express dates See SET and SHOW commands

Homework Keep working on projects Make posting on Open Source: what it means to you and what you think about it. –THINK! why would a company use Open source and why not what does it mean for information technology worker