Creating Databases for Web Applications State capitals quiz: demonstrates parallel structures AND multi-purpose php files Classwork: design a new quiz.

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

PHP I.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK) Lecture 3 PHP (2) : Functions, User Defined Functions & Environment Variables.
CHAPTER 3 MORE ON FORM HANDLING INCLUDING MULTIPLE FILES WRITING FUNCTIONS.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
What are the features of Moodle? Do NOT view this PowerPoint as a show. You need to be able to read the notes down below.
Programming games Classwork: Show Favorite Sites. Show coin toss. Review concepts. Crooked coin toss. Homework: Complete coin toss examples. Upload files.
Creating Databases for Web Applications State capitals quiz Classwork: design a new quiz Homework: Make sure you can upload files and have MySQL database.
Programming games Reprise on dice game and alternative dice game Homework: [Catch up.]. Finish dice game.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Creating Databases applications for the Web Reprise. Basic HTML review, forms Preview: Server side vs client side Classwork: create HTML forms and check.
Grade Scale Test 1 Results: Average class score after partial credit: __________ Commonly missed questions: #_________________ If you got less than 70%
Creating Databases SELECT. UPDATE. Demonstrate projects. Classwork / Homework: Prepare to choose teams & projects.
PHP: Hypertext Processor Fred Durao
Creating Databases for Web Applications Posting due by next class on project! Lab: using files & work session Class: asp Application object 3-tier, separating.
JavaScript Form Validation
PHP : Hypertext Preprocessor
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
SIMPLE ROUTER The slide made by Salim Malakouti. Next we will create the Router  What do I we mean by a router?  Routers work similar to a map. It receives.
Creating databases for web applications SQL. Systems design. ER diagrams. Data flow diagrams. Storyboards. Homework: Plan database and applications for.
Creating databases for web applications Play quizzes Testing process regular expressions: form validation PHP coding handling forms Homework: regular expressions.
CSCI 6962: Server-side Design and Programming Validation Tools in Java Server Faces.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Introduction to the WebBoard Terry Dennis. The WebBoard - Our Connection The WebBoard URL is
Creating Databases Uploading Files. Reading & writing files. Homework: Starting planning ‘original’ project.
Creating Databases for Web Applications Library diagrams Continue with diagrams for video clip archive and for (Flash) grid design. General and specific.
PHP meets MySQL.
Programming Games Show your simple video. More video examples. Audio. Classwork/Homework: Produce more complex video program.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Programming games Examples. Classwork: work and show something of your final project. Homework: (finish…)
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
Creating databases for Web Applications php basics. ing. phpMyAdmin to set up MySQL. Homework: Use phpMyAdmin. Make posting with [unique] source on.
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 Library. New example: student database. Homework: Complete class example. Catch up on source postings. Do creation.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
Advanced Work with Embedded and Summative Assessment Dr. Steve Broskoske Misericordia University EDU 533 Computer-based Education.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
1 Project 3 The Kumquat Society Conference. 2 Conference Registration In this project you will write a program to handle a conference registration. The.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
U:/msu/course/cse/103 Day 21, Slide 1 CSE 103 Makeups –If you didn’t take one over the weekend, take one TUESDAY or WEDNESDAY!
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
PHP Error Handling & Reporting. Error Handling Never allow a default error message or error number returned by the mysql_error() and mysql_errno() functions.
Creating Databases for Web applications SQL. XML. Linked Lists. NoSQL. Homework: Keep working on projects. Post constructive feedback on other projects.
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab 03.
Creating Databases for Web Applications 3-Tier. Design vs Function vs Content. More SQL. More php. Homework: work on final projects.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
Creating interfaces Multi-language example Definition of computer information system VoiceXML example Project proposal presentations Homework: Post proposal,
Logical Operators.  Quiz  Let's look at the schedule  Logical Operators 2.
IST 210: PHP LOGIC IST 210: Organization of Data IST210 1.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Creating User Interfaces VoiceXML. Examples. Classwork/Homework: Make proposal and start work on your VoiceXML project.
Class07 PHP: loops and includes MIS 3501, Fall 2015 Brad Greenwood, PhD MBA Department of MIS Fox School of Business Temple University 9/15/2015.
Creating Databases for Web applications Making a table of table information. Reprise on database design. SQL. Classwork/Homework: Projects! Postings.
Programming Games Reprise Credit Cards! Reprise Binary. Overall time limit, setTimeout Homework: [Show virtual something.] Make proposal as reply to my.
A little PHP. Enter the simple HTML code seen below.
Creating Databases for Web applications
Creating Databases for Web Applications
A little PHP.
Creating Databases Local storage. join & split
Creating databases for web applications
Performance and User Experience Improvements to the ASU/NASA Space Grant Website
Creating Databases for Web Applications
Today’s Objectives Week 12 Announcements ASP.NET
Programming games Reprise on dice game and alternative dice game
Presentation transcript:

Creating Databases for Web Applications State capitals quiz: demonstrates parallel structures AND multi-purpose php files Classwork: design a new quiz Homework: Make sure you can upload files and have MySQL database. Get a simple quiz working like the state capital quiz. Post unique source on REGULAR expressions.

multi-purpose php files Used to both –present a form and –check the input in a form. Replacement for html and php pair. Advantages: –don’t have to coordinate two files –less files to handle Disadvantages –need to include coding to make determination

Use sign sign is used to suppress error messages. We will use it in the code to test if something, namely a form input, exists. –if it does, then control goes to the code for handling the form –otherwise, control goes to the code for displaying the form Also use it to suppress an error when one input is missing

rand Built-in php function. Takes two arguments. rand(a, b), a and b integers, returns random value from a, … b. Check out shuffle, mt_rand. Extra credit posting opportunity to explain.

State capital quiz meyer/statecapquizask.phphttp://socialsoftware.purchase.edu/jeanine. meyer/statecapquizask.php Choose what to be asked –Note: how can this be worded better???? Ask Check the answer –Give chance to try again or –Go back to get new question

State capitals quiz Implementation: three php files. Two of the php files call themselves and include the other file. –statecapitals.php This file is include[d] in the others. It sets up 2 parallel arrays holding the names of the states and the capital cities. –statecapquizask.php This is a multi-purpose file. –statecapquizcheck.php This is also a multi-purpose file. Checks answer. Allows for another guess or goes back to statecapquizask.php

State capitals storyboard statecapquiz.php statecapquizcheck.php Include file: statecapitals.php

Programming practices Parallel structures, in this case the array of states corresponding to the array of capitals, is a common programming device. Think of it as an alternative to a database or xml for very simple cases. Repeat: multi-purpose, self-referencing of php scripts is a common practice –benefits: reduces number of files. Information in one place –negatives: the one file is more complex

statecapitals.php <?php $states = Array(); $capitals = Array(); $states[]="Alabama"; //adds to array $capitals[]="Montgomery"; $states[]="Alaska"; $capitals[]="Juneau"; …

statecapquizask.php State capitals quiz: check State Capital Quiz <?php if ($saywhich){ include("statecapitals.php"); $which=$_GET['which']; $choice=rand(0, sizeOf($states)-1);

if ($which=='state') { $state = $states[$choice]; print("What is the capital of $state? "); print(" \n"); print(" "); print(" \n"); }

else { $capital = $capitals[$choice]; print("$capital is the capital of which state? "); print(" \n"); print(" "); print(" \n"); }

else { print("Choose form of question: do you want to be given the state or the capital? "); print(" \n"); print("Ask State"); print(" Capital\n"); print(" \n"); print(" "); print(" "); } ?>

statecapquizcheck.php State capitals quiz: check <?php include('statecapitals.php'); $choice=$_GET['choice']; $which=$_GET['which']; $correctstate=$states[$choice]; $correctcapital=$capitals[$choice];

if ($which=='state') { if ($capital == $correctcapital) { print("Correct! $correctcapital is the capital of $correctstate!"); print(" Play again "); }

else { print("WRONG! \n"); print(" New turn \n"); print("OR try again: What is the capital of $correctstate? "); print(" \n"); print(" "); print(" \n"); } }

else { if ($state == $correctstate) { print("Correct! The capital of $correctstate is $correctcapital!"); $saywhich='false'; print(" Play again "); }

else { print("WRONG! \n"); print(" New turn \n"); print("OR try again: $correctcapital is the capital of what state? "); print(" \n"); print(" "); print(" \n"); } } ?>

else { $capital = $capitals[$choice]; print("$capital is the capital of which state? "); print(" \n"); print(" "); print(" \n"); } }

else { print("Choose form of question: do you want to be given the state or the capital? "); print(" \n"); print("Ask State"); print(" Capital\n"); print(" \n"); print(" "); print(" "); } ?>

Reprise if statements within if statements php produces the appropriate html, including the form element The php is printing (producing) html. It is not operating the quiz! There are ways to enhance this program –perhaps limit the number of re-tries –prevent browser from showing previous inputs –see next slide…

Note Answer must be exact! Sometimes this is not appropriate. Consider NOT requiring exact case. –Extra credit opportunity Consider something else, such as inexact spelling. What is close enough? How to measure? Use of regular expression is a way to present a pattern of answers as opposed to a set answer. Later: we will cover the use of LIKE as an operator in MySql statements

Classwork (teams) Design simple quiz like the state capital quiz, using parallel arrays for questions and answers –Ideas? OR make significant enhancement to my quiz, like adding scoring, limiting re-tries OR some other quiz!

Homework Get your quiz working. Post link in posting to the General Discussion Forum. Research and post unique source on Regular expressions on moodle. We use regular expressions –to validate input and extract information from input. –potential for quizzes.