Creating Databases for Web Applications Reprise: Systems design (diagrams) Flash to php Homework: Prepare for quiz.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

Adding Dynamic Content to your Web Site
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Multiple Tiers in Action
Lecture 4: Introduction to PHP 3 PHP & MySQL
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Creating Databases applications for the Web Reprise. Basic HTML review, forms Preview: Server side vs client side Classwork: create HTML forms and check.
PHP: Hypertext Processor Fred Durao
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
Creating Databases for Web Applications Posting due by next class on project! Lab: using files & work session Class: asp Application object 3-tier, separating.
PHP : Hypertext Preprocessor
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
JavaScript & jQuery the missing manual Chapter 11
Creating databases for web applications
Creating databases for web applications Walk before run? Songs with features example. Retrieve information from database. Recordsets. Arrays. Loops. Homework:
Homework for October 2011 Nikolay Kostov Telerik Corporation
Server-side Scripting Powering the webs favourite services.
Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation.
Creating Databases for Web Applications Work session Open Source versus Proprietary important topics HW: finish* projects. Look at final quiz guide. Final.
Creating databases for web applications SQL. Systems design. ER diagrams. Data flow diagrams. Storyboards. Homework: Plan database and applications for.
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.
Simple Database.
Creating Databases for Web Applications Library diagrams Continue with diagrams for video clip archive and for (Flash) grid design. General and specific.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
CHAPTER 8: MANAGING DATA RESOURCES. File Organization Terms Field: group of characters that represent something Record: group of related fields File:
Technology vocabulary slides assignment. Application Definition : A program or group of programs designed for end users. Application software can be divided.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
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.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Website Development with PHP and MySQL Saving Data.
HTML, PHP, and MySQL: Putting It All Together. Making a Form Input tags Types: “text” “radio” “checkboxes” “submit”
Creating databases for Web Applications php basics. ing. phpMyAdmin to set up MySQL. Homework: Use phpMyAdmin. Make posting with [unique] source on.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
Creating Databases Local storage. join & split Classwork: show 1 table application. Share designs for oscars application. Adaptive select. Homework: [Catch.
Creating Databases applications for the Web Basic HTML review, forms Preview: Server side vs client side Flash HW: Review HTML forms and FLASH examples.
Creating databases for web applications Library. New example: student database. Homework: Complete class example. Catch up on source postings. Do creation.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
School of Computing and Information Systems CS 371 Web Application Programming AJAX.
Using Flash with php Very quick introduction to Flash Homework: work on projects.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
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)
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
Creating databases for web applications Report on using sources, getting examples working. Retrieve information from database. Recordsets. Arrays. Loops.
Creating Databases for Web Applications 3-Tier. Design vs Function vs Content. More SQL. More php. Homework: work on final projects.
FTC Relate Tables. Show Relations for Tables S13 MIS 2 Left Side – Decide on the Relations among tables for CS/Ops Facilities Info Tables Right Side –
Creating Web Documents: JavaScript Ftp / file management: review Introduction to JavaScript Sources Homework: start review for midterm, work on Project.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
JavaScript and Ajax Week 10 Web site:
IST 210: PHP Basics IST 210: Organization of Data IST2101.
E-commerce Architecture Ayşe Başar Bener. Client Server Architecture E-commerce is based on client/ server architecture –Client processes requesting service.
Creating Databases for Web applications
Creating databases for Web Applications
Creating Databases Local storage. join & split
Learning to Program D is for Digital.
PHP / MySQL Introduction
Database Driven Websites
WEB API.
Web Application Development Using PHP
Presentation transcript:

Creating Databases for Web Applications Reprise: Systems design (diagrams) Flash to php Homework: Prepare for quiz

Systems design Focus on information –what is the information and how do [things] relate –Entity relationship diagrams is tool –Information may exist already in the organization Focus on function of application(s) –who does what –… using what information

System design slow down rush to implement [start] documentation Design and documentation may change as system is being built, deployed, refined…. Still, goal is to decrease bugs

ER diagram Database holds –Tables. Table represents one type of entity Row in table holds information on one example of the entity –Row in table made up of Attributes (aka fields) Lines connecting tables indicate occurrence of attribute in one table that points to a row in another table (or that table) –What is the pointer? The id of the row. This is called a foreign key. Seems simple but recall how definition of library changed (evolved) during discussion

Store Vendors (suppliers) –v_id, name, address Shipments from vendors –s_id, vendor=v_id, expected_date, status (orders, received, partial), billed_amount Item_in_shipment –i_ship_id, s_id, p_id Products –p_id, name/description, vendor=v_id, size, type, quantity_in_stock, cost, base_price

Design to build Use system design to plan Decide on technologies –software & hardware For example, what programming languages? what DBMS? who does / who can do each process? should application be customized for PDA (e.g., IPOD) Plan / invoke usability standards. Plan testing / involvement of users Allocate and schedule work –refine / update documentation Deploy / deliver / distribute

Software decision What already exists? –inside organization –generally available something such as Google Maps API? Open source Make / buy What is level of expertise in organization?

Example: What are pros/cons JavaScript Processing ActionScript

Continue with implementation of video clip archive NOTE: ActionScript invoking and getting something back from php scripts Compare to: –html action=php script –THEN php creates a new html file

Aside html is interpreted by the browser on the client computer php is interpreted by the php engine installed on the server computer SQL is interpreted by the MySQL program on the server computer.

ActionScript basics Code, that is, ActionScript is in the.fla file, –created in the Flash development environment using the Actions panel –associated with frame in separate.as files –created in the Flash development environment –each file formatted as a package named class in Document package named class in named package

ActionScript basics review Data is in internal variables or dynamic or input text fields on the Stage –Text field needs a name. Get contents by.text attribute fromaddress.text Set up response to event using addEventListener(name of event, function) –sendbtn.addEventListener(MouseEvent.CLICK, send ); –loader.addEventListener(Event.COMPLETE, getfromdb);

ActionScript to/from php URLRequest object: holds the php file name URLVariables object: holds the data sent to php URLLoader object: holds the data from php NOTE: this is not instant! It is asynchronous process. Need to wait for the Event.COMPLETE event Look at specific code!

Bo example: from send function: 1 direction, don't need to use URLLoader var request:URLRequest = new URLRequest("send .php"); var variables:URLVariables = new URLVariables(); var gameURL:String = " //multiple inputs to the php variables.body="I caught Bo on "+caught+". Visit "+gameURL; variables.to=toaddress.text; variables.subject="news"; variables.from = fromaddress.text; request.data = variables; request.method=URLRequestMethod.POST; sendToURL(request); }

Bo example: send .php <?php $to = $_POST['to']; $subject = $_POST['subject']; $body = $_POST['body']; $headers = "From: ". $_POST['from']; if (mail($to, $subject, $body,$headers)) { echo("Your message was sent"); } else { echo("There was a problem."); } /* the error messages will not appear if called from Flash application, but will appear if called from html */ ?>

Video example choosevideoplay.fla uses an external Class definition Video3.as –Invokes php functions to get information to populate each of two ComboBox components –Note: the data returned is the name of the video file NOT the video file itself.

Video example: cbHandler: a group of clips has been selected, the group name is to be sent to php private function cbHandler(event:Event):void { aTa.text = "Group: " + event.target.selectedItem.data; var variables:URLVariables = new URLVariables (); variables.group = event.target.selectedItem.data; var request:URLRequest = new URLRequest(); request.data = variables; request.url = "getgroupclips.php"; var loader:URLLoader = new URLLoader(); loader.load(request); loader.addEventListener(Event.COMPLETE, getgroupclips); }

Function: getgroupclips(event:Event) gets data from php encoded with, and : var clips:String = event.target.data; var clipsarray:Array = clips.split(","); var cliptitles:Array = new Array(); var clipaddrs:Array = new Array(); var clipinfo:Array; var i:int; var num:int; num = clipsarray.length; for(i=0;i<num;i++) { clipinfo = clipsarray[i].split(":"); cliptitles.push(clipinfo[1]); clipaddrs.push(clipinfo[0]); } … more …

Video example: getgroupclips.php <?php require("opendbq.php"); $group = $_GET['group']; $query = "SELECT fileaddr, cliptitle FROM videoclips2 where clipgroup='". $group. "'"; $result = mysql_query($query); $sendback = ""; mysql_close(); $num = mysql_num_rows($result);

getgroupclips.php, cont. $i = 0; while ($i<$num) { $fa = mysql_result($result,$i,"fileaddr"); $ct = mysql_result($result,$i,"cliptitle"); $sendback = $sendback. "$fa:$ct"; $i++; if ($i<$num) { $sendback = $sendback. ","; } } print "$sendback"; ?> Putting in the colon Putting in the comma

Grid design example Design is list of x, y coordinates and name of symbol in cell at those coordinates Sends and receives [long] string that was/will be XML Use built-in ActionScript to set up XML and then extract information about the design

Example: function fetchfromdb(ev:Event) sends data (request) to a php file var request:URLRequest = new URLRequest("fetchdesign.php"); var variables:URLVariables = new URLVariables(); variables.designname=playersfilename.text; request.data = variables; playersfilename.text ="fetching "; var loader:URLLoader = new URLLoader(); loader.load(request); loader.addEventListener(Event.COMPLETE, getfromdb);

Function getfromdb(ev:Event) gets the information back from php var ds:String = ev.target.data; var dxml:XML = new XML(); if (ds.length>4) { dxml = new XML(ds); restoredesign(dxml); // my function to use the XML } else { //empty data is 4 bytes long! playersfilename.text = "Design not in database"; }

fetchdesign.php <?php $des_name = $_REQUEST['designname']; require("opendbq.php"); $query="SELECT des_string from designs where des_name='$des_name'"; $result=mysql_query($query); $NoR if ($NoR>=1) { $sendback = mysql_result($result,0,"des_string"); } else { $sendback = ""; } print $sendback; mysql_close($link); ?>

Comments The php back to Flash ActionScript uses print or echo. The $sendback is my name. It could be anything. The stuff sent back is the ev.target.data Note: use of the aTa.text field to show you what is going on. This is not necessary in the html to/from php.

Homework Practice ! –php to MySQL –ERD, DFD, [Storyboard] Check out on-line midterm study guide Catch up, review next class.