Presentation is loading. Please wait.

Presentation is loading. Please wait.

Paul Jacobs The iSchool University of Maryland Thursday, Nov. 17, 2016

Similar presentations


Presentation on theme: "Paul Jacobs The iSchool University of Maryland Thursday, Nov. 17, 2016"— Presentation transcript:

1 Paul Jacobs The iSchool University of Maryland Thursday, Nov. 17, 2016
INFM 603: Session 11 Review Paul Jacobs The iSchool University of Maryland Thursday, Nov. 17, 2016 This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States See for details

2 Today’s Topics Highlights of the Class
A Look Forward at Related Courses Preview of Final Exam Q&A

3 Some Things You Probably Know
What is HTTP? How does it relate to TCP? To IP? What is a DNS? How does a web server communicate with your browser? What is HTML and its relationship to XML and SGML? What is a style sheet? Why would one use a “linked” style sheet? What does “cascading” mean? What is a “tag”? Why would we use a tag such as <DIV> or <SPAN> that doesn’t directly tell the browser what to display? What are some examples of features controlled by styles? What is special about the <FORM> tag? What is the difference between “submit” and “clear”? What is the difference between client-side and server-side scripting? What is special about JavaScript? What is a data type? An expression? A control structure? A data structure? What is a “for” loop? Why do we need curly braces {} in our code? Why do we need parentheses? What is the difference between + and ++? Between = and ==? What is a function? What is an argument (to a function)? How are variables used? Why do we use functions instead of just writing longer scripts? What is an “event” in JavaScript? What are some examples of events? What is the DOM? How is the DOM used? When we see “window.prompt” or “document.write”, what does the word before the dot (“window” or “document”) signify and what does the word after (“prompt” or “write”) signify? How about in document.getElementByID(“thisid”).innerHTML? What is a database? What are some features of “relational” databases? Some examples? How do “objects” in programming languages relate to databases? What is “normalization”? Why do we need to normalize a database? What is a “schema”? How do we communicate a database schema? Why is it important? What is SQL? What is the difference between “DROP” and “DELETE” in SQL? What is a “join” and why do we need “joins”? What is a “key”? A “foreign key”? What is the relationship between SQL and PHP?

4 Some Things You Probably Know (cont’d)
What is PHP? Why doesn’t my PHP script work on my Mac? Where does it work? Where does a PHP script typically get its input? What is (typically) its output? What does PHP do with HTML? Can a PHP script access the DOM? Why not? How does a PHP script interact with a database? What is an array in programming? What are two ways of accessing an array? What is the relationship between an array and the result of a SQL query in PHP? What is “recursion”? Why/how would you write a recursive program? What is AJAX? Why has AJAX become important in “Web 2.0” programming? Can the user always tell whether a form is using AJAX or PHP (or both)? How might you tell? What is “responsive” design? How do web sites today become responsive? What is a CMS “theme”? A “template”? How would I typically create/change a theme? A template? What are the advantages/disadvantages of using a CMS for my site? How should I choose a CMS? What are some examples of software engineering “methodologies”? What are some differences between the “waterfall” model and “Agile”? What is “iterative” development? What are some changes that have occurred in technology development since its “early” years (say, the moon landing)? Are there any disadvantages of Agile? Does anyone still use the “waterfall” model? Does anyone still program in “FORTRAN”? In “assembly language”? What are some examples of “cloud” applications today? What are some advantages/disadvantages to the “cloud”? Did we use the “cloud” in this class? How?

5 Some Scenarios I Hope You’ll Be Able to Handle Better Now
You manage a team; your developer tells you “I’ll have the server-side scripting done by next week” Your team has to choose a CMS (or CRM, or HRMS); your boss says she’d like to use Microsoft because she’s heard they’re the best (or Joomla, because she’s heard they’re free) Your web designer says he builds all his HTML pages “from scratch” because he doesn’t “like the look” of WordPress/Drupal/Joomla/… pages

6 Some Scenarios I Hope You’ll Be Able to Handle Better (cont’d)
Your engineer says, a “cloud” solution is out because of security concerns The sales rep says their vendor solution is the best for your needs because it meets all of your requirements and you get a special price since it’s the end of the quarter 75% of your budget for the project is committed to the cost of software, consulting and engineering

7 Information, data, and life
wisdom knowledge information data data

8 Examples – How We Use Data
Information “The letter ‘A’ ” My bank balance Knowledge “When you make a withdrawal, you subtract the withdrawal amount from your account balance” “A person’s age must be lower than that of his/her biological mother” Wisdom “Neither a borrower nor a lender be” “Spend less than thou earnst”

9

10 Client Web browser Web server Application logic Databases and DBMS
Common gateway interface Application logic Databases and DBMS Application partition

11 HyperText Transfer Protocol (HTTP)
Send request GET /path/file.html HTTP/1.0 From: User-Agent: HTTPTool/1.0 Server response HTTP/ OK Date: Fri, 31 Dec :59:59 GMT Content-Type: text/html Content-Length: 1354 <html><body> <h1>Happy New Millennium!</h1> … </body> </html> The Difference Between FTP and HTTP File Transfer Protocol, or FTP, is a protocol used to upload files from a workstation to a FTP server or download files from a FTP server to a workstation. It is the way that files get transferred from one device to another in order for the files to be available on the Internet. When ftp appears in a URL it means that the user is connecting to a file server and not a Web server and that some form of file transfer is going to take place. Most FTP servers require the user to log on to the server in order to transfer files. In contrast, Hyper Text Transfer Protocol, or HTTP, is a protocol used to transfer files from a Web server onto a browser in order to view a Web page that is on the Internet. Unlike FTP, where entire files are transferred from one device to another and copied into memory, HTTP only transfers the contents of a web page into a browser for viewing. FTP is a two-way system as files are transferred back and forth between server and workstation. HTTP is a one-way system as files are transported only from the server onto the workstation's browser. When http appears in a URL it means that the user is connecting to a Web server and not a file server. The files are transferred but not downloaded, therefore not copied into the memory of the receiving device.

12 HyperText Markup Language (HTML)
Simple document (page) structure language for Web Historically based on SGML (Standard Generalized Markup Language, for publishing) Advantages Adapts easily to different display capabilities Widely available display software (browsers) Disadvantages Does not directly control layout Does not formally specify data structures (ergo XML)

13 What is HTML (more)? HyperText Markup Language
Standard language for transmitting web pages/web content The input that allows web browsers to function The framework within which many scripts are written The output of many scripts

14 Embedding Images in HTML
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <!-- Fig. 4.7: picture.html --> <!-- Adding images with XHTML --> <html xmlns = " <head> <title>Internet and WWW How to Program - Welcome</title> </head> <body> <p><img src = "xmlhtp.jpg" height = "238" width = "183" alt = "XML How to Program book cover" /> <img src = "jhtp.jpg" height = "238" width = "183" alt = "Java How to Program book cover" /></p> </body> </html> Picture.html © Prentice Hall The value of the src attribute of the image element is the location of the image file. The height and width attributes of the image element give the height and width of the image. The value of the alt attribute gives a description of the image. This description is displayed if the image cannot be displayed.

15 Each form must begin and end with form tags.
HTML Forms 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 5.3: form.html --> 6 <!-- Form Design Example 1 --> 7 8 <html xmlns = " <head> <title>Internet and WWW How to Program - Forms</title> </head> 12 <body> 14 <h1>Feedback Form</h1> 16 <p>Please fill out this form to help us improve our site.</p> 19 <!-- This tag starts the form, gives the method of --> <!-- sending information and the location of form --> <!-- scripts. Hidden inputs contain > <!-- non-visual information > <form method = "post" action = "/cgi-bin/formmail"> 25 <p> value = "main.html" /> </p> <input type = "hidden" name = "recipient" value = /> <input type = "hidden" name = "subject" value = "Feedback Form" /> <input type = "hidden" name = "redirect" 32 Form.html © Prentice Hall Each form must begin and end with form tags. The method attribute specifies how the form’s data is sent to the Web server. The post method appends form data to the browser request. The value of the action attribute specifies the URL of a script on the Web server. Input elements are used to send data to the script that processes the form. A hidden value for the type attribute sends data that is not entered by the user.

16 Some Other Form Elements and Attributes
<select> [element] - drop down list with <selected> attributes checkbox [attribute, e.g. <input name = “instructor” type = “checkbox” value = “Jacobs”>] radio [attribute] - radio button, e.g. <input name = “heardaboutus” type = “radio” value = “friend”> Password [attribute] Forms go with scripts (to come later; the input name and value “posts” to the script as a variable value)

17 How Are Web Pages Created?
Static pages using text editors (Notepad, Wordpad, Notepad++, emacs, VI, . . .) Good for practice Can be good for programming (e.g., Notepad++) Static pages using HTML editors (esp. WYSIWYG) like DreamWeaver, KompoZer Much faster for certain features, like layout, images Still allows hardcore HTML editing and programming Can support site publishing and site management Content Management Systems like Drupal, Joomla, WordPress Better for re-use, large scale site creation Can be harder to customize, program

18 Cascading Style Sheets (CSS)
Separating content and structure from appearance Rules for defining styles “cascade” from broad to narrow: Browser default External style sheet (also called “linked” style sheet) Internal style sheet (also called “embedded” or “page-level” style) Inline style (also called “local”)

19 External (Linked) Style Sheet Example – HTML file
<!DOCTYPE html> <html xmlns=" dir="ltr" lang="EN"> <head> <meta http-equiv="content-type" content="text/xml;" charset="utf-8"> <title>SimpleLinkedStyle.html</title> <link rel="stylesheet" type="text/css" href="SimpleStyle.css"> </head> <body> <h1>This is the headline using the linked style sheet</h1> <p> This is some text using the linked style sheet </p> </body> </html> Notice that there are no styles at all on this page – only the link

20 External (Linked) Style Sheet Example – CSS file
/* Generated by KompoZer – SimpleStyle.css */ body { color: #ffffff; background-color: #9999ff; } h1 { color: #ffff33; text-align: center; font-family: fantasy; font-style: italic; font-variant: normal; font-weight: normal; font-size: 200%; . . . p { border: 3px groove #ffff33; background-color: #ffff33; color: #333300; text-align: right; The .css file contains only the style definitions Notice that this is not an HTML file – CSS files are in a different language with different syntax from HTML!

21 These ids can be applied within different <p> tags
Using Style IDs . . . <title>Quote.html</title> <style type = ”text/css”> #quote { font: bold italic 130% Garamond, Comic Sans MS, fantasy; text-align: center; } #attribution { font: 80% monospace; text-align: right; </style> </head> <body> <h1>Literature Quote of the day</h1> <p> How to tell somebody off the classy way: </p> <p id = ”quote”> Thou] leathern-jerkin, crystal-button, knot-pated, agatering, puke-stocking, caddis-garter, smooth-tongue, Spanish pouch! <p id = ”attribution”> -William Shakespeare (Henry IV Part I) </body> The .# selectors give the style sheets for the “quote” and “attribution” ids These ids can be applied within different <p> tags

22 Goals for JavaScript Session
Understand how JavaScript and HTML/CSS interact in designing and implementing web sites Learn the basics of JavaScript so that you are able to write programs and learn more Use JavaScript to help understand the foundations of computer programming Algorithms Control structures (such as program steps, different types of loops, conditional statements) Data structures (variables, data types, structures, arrays) Object oriented principles (modularity, encapsulation, inheritance, etc.)

23 Where do we See JavaScript at Work?
Form validation – JavaScript programs check user inputs on web pages – e.g., “Please enter the date in the format MM/DD/YYYY” Navigation tools – JavaScript has events like “onmouseover” and “onclick” that can be used to introduce “drop downs” and other menu tools Autocompletes, such as in search boxes Animations, information that changes frequently (temperature, stock tickers, time), numerous other dynamic page features Simple lookups and calculations

24 The second argument is the default value for the text field.
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " <!-- Fig. 7.6: Addition.html --> <!-- Addition Program > <html xmlns = " <head> <title>An Addition Program</title> <script type = "text/JavaScript"> <!-- var firstNumber, // first string entered by user secondNumber, // second string entered by user number1, // first number to add number2, // second number to add sum; // sum of number1 and number2 // read in first number from user as a string firstNumber = window.prompt( "Enter first integer", "0" ); // read in second number from user as a string secondNumber = window.prompt( "Enter second integer", "0" ); // convert numbers from strings to integers number1 = parseInt( firstNumber ); number2 = parseInt( secondNumber ); // add the numbers sum = number1 + number2; The window method prompt displays a prompt dialog in the browser with a message and a text field for input. The first argument passed to method prompt is the message to be displayed. The second argument is the default value for the text field. Function parseInt converts its string argument to an integer. The + operator adds the two numbers input by the user.

25 For Loop with HTML/CSS Initialization Repetition condition
1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" " 4 5 <!-- Fig. 9.2: ForCounter.html > 6 <!-- Counter-Controlled Repetition with for structure --> 7 8 <html xmlns = " <head> <title>Counter-Controlled Repetition</title> 11 <script type = "text/JavaScript"> <!-- // Initialization, repetition condition and // incrementing are all included in the for // structure header. for ( var counter = 1; counter <= 7; ++counter ) document.writeln( "<p style = \"font-size: " + counter + "ex\">XHTML font size " + counter + "ex</p>" ); // --> </script> 23 </head><body></body> 25 </html> Initialization Repetition condition Incrementing

26 What is a Database? A database is a mechanism (or system) for organizing and storing information. Within applications, databases are modules (also known as a “tier”) that provide storage and access to widely-used objects Within implementations, databases represent a layer that takes care of, and hides, many aspects of dealing with large quantities of information

27 Why do Applications Need Databases?
Persistence - In your code, data exists only when the program is running Sharing – Information in a database can be used by different programs, applications Many other features that go along with all that – Access control and security, concurrency control, data backup, etc.

28 Relational Database Concepts to Know
Schema – the overall design, organization and relationships in a database Tables – the names of data entries and their relationships Fields and columns – the types of entries themselves Records and rows – the individual entries (instances) Keys – fields that uniquely identify a record Relationships – structures or groupings between fields Data types – constraints on fields, such as strings, numbers, dates, etc.

29 Database Schema Example

30 Relating Different Terms
Class  Table (Entity) Object  Record (Row) Attribute  Column (Field, Attribute) Association  Relationship

31 What is Normalization? A method for organizing data elements into tables. Done in order to avoid Duplication of data Insert anomaly Delete anomaly Update anomaly Database designs can be in first normal form (1NF), second normal form (2NF), and third normal form (3NF) – ideal is 3NF

32 What is SQL (Structured Query Language)?
The “interlingua” of relational databases (e.g., Oracle, SQLServer, MySQL, Postgres, DB2, etc.) An international standard (ISO 9075) A common method of building and querying databases A common method of building database interfaces (e.g., using ASP, JSP, PHP) A common method of building connectors from applications to databases (e.g., using XML, SOAP and ODBC/JDBC)

33 PHPMyAdmin Output - Join

34 Goals for PHP Session Revisit and understand the role of server-side scripts in web-based applications Understand how to integrate PHP with XHTML Embedding PHP code into HTML Generating HTML from PHP to display on the client Using variables and other constructs Understand how to use XHTML forms with PHP Revisiting the “post” action Getting values from form input Displaying resulting XHTML Understand how to integrate with MySQL – Accessing and updating databases

35 Why Server-Side Scripts?
“We” meaning app. developers, have control over the environment (software installed, data, security, etc.) – not dependent on clients/users Scripts can access a huge range of data and applications that may be inaccessible to clients directly – control the interface Many different scripting languages are available (PHP, Ruby, Perl/Python, Java, . . .) depending on needs, programming resources

36 PHP – MySQL – Pet Form Example – PHP Code
When posting to PHP, you usually just get all the variable data from the form <?php extract ( $_POST ); ?> <!-- petupdate.php > <!-- Read information sent from input form --> <html xmlns = " <head> <title>Pet Form Validation and Database Update</title> </head> <body style = "font-family: arial,sans-serif"> <p>Hi <span style = "color: blue"> <strong> <?php print( "$petname" ); ?>'s owner </strong> </span>. Thank you for telling us about <?php print ("$petname"); ?> .<br /> He/she has been added to the <?php print( "$petbreed " ); ?> </span> database. </p>

37 PHP – MySQL – Pet Form Example – PHP Code (cont’d)
// Create MySQL connection $database = new mysqli("localhost", "testuser1", "*********", "testuser1_pets"); // Check connection if ($database->connect_error) { die("Connection failed: " . $database->connect_error); } if ( !( $result = $database->query ( "SELECT ID FROM Petfoods WHERE Name = '$petfood'") ) ) print ("Warning! could not execute food query <br />" ); $row = $result->fetch_assoc(); $foodid = $row["ID"]; if (! ( $result = $database->query ( "SELECT OwnerID FROM PetOwners WHERE Name = '$ownername'") ) ) print ("Warning! could not execute owner query <br />" ); if ( $row["OwnerID"] == 0 ) // if the owner isn’t already there { $database->query ("INSERT INTO PetOwners " . " ( Name , TelNo , ) " . "VALUES ( '$ownername' , '$ownertelno' , '$owner ' )"); $ownerid = $database->insert_id; This gets the key ID of the chosen pet food.

38 Some Advanced Data Structures
Arrays (also can be seen as vectors, matrices) – generally used to keep fixed sets of like objects – e.g., a deck of cards [52] or [4][13], a chess board [8][8] Queues – similar to arrays, but can be of variable length, and keep track of position – First In, First Out (FIFO). Stacks – like queues, but Last In, First Out (LIFO). “Push” means add to the “top” of a stack, “Pop” means get the last (top) element. Other objects and structures, pointers

39 Objects (JavaScript) Var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}; Objects written as name value pairs are similar to: Associative arrays in PHP Dictionaries in Python Hash tables in C Hash maps in Java Hashes in Ruby and Perl Objects can have “constructor” functions, e.g.  person(first, last, age, eye) {     this.firstName = first;     this.lastName = last;     this.age = age;     this.eyeColor = eye; } “this” is a special keyword – similar to a variable – that refers to the object that “owns” a particular function

40 Object Methods (JavaScript)
Methods are functions that apply to objects. For example, document.writeln is a method that applies to the document object. Is a method that could apply to the person object. var person = { firstName: "John", lastName : "Doe", id : 5566, fullName : function() { return this.firstName + “ " + this.lastName; } }; fullName function() {return this.firstName + " " + this.lastName;}

41 The HTML DOM (Document Object Model)
Allows Javascript to interact with the web page being displayed Supports dynamic HTML, interactive pages (often described as part of “Web 2.0” We’ve already used DOM a bit in class: document.getElementById() is a DOM method .innerHTML is a DOM property (or attribute) onclick, onkeyup, onchange, onmouseover are DOM events

42 AJAX Asynchronous JavaScript And XML (but not always XML!)
Used to get dynamic content from the server without re-loading the HTML page (as compared with PHP, for example) Asynchronous means other actions don’t have to wait (not synchronized), faster, but this can be tricky Now the basis for many other cool interactive layers and libraries

43 Typeahead w/PHP/MySQL
Load the same scripts prefetch just says get the list of pet names from the database using PHP script Showpetinfo() runs when the pet name entry changes, gets it from the DOM and then fetches database results from DB to put back in the DOM <head> <title>Example of using JQuery to Get Typeahead from Database</title> <script src="js/jquery min.js"></script> <script src="js/typeahead.bundle.min.js"></script> --> <script type="text/javascript"> // fetch the pet names from the database and match var petnames = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace, limit: 20, prefetch: 'lookaheadpetname.php' }); //populate the typeahead // passing in `null` for the `options` arguments will result in the default // options being used $('#my-input .typeahead').typeahead(null, { name: 'petnames', source: petnames, function showpetinfo () { // print out info from database about that pet petchoice = $('#petname').val(); $('#results').load("getpetinfo.php", {'petname' : petchoice}); } </script> </head> The typeahead uses the list of pet names

44 Overview – Content Management Systems (CMS)
What are they? A layer that uses CSS to provide a unified, stylized feel to a web site A set of administrative tools for organizing and managing sites (e.g., including login, adding/removing pages, personalization, etc.) An extensible framework for managing dynamic (and potentially customized/personalized pages) built upon a database structure Some examples Open-source (free) – WordPress, Joomla, Drupal (maybe 100 others) Proprietary – OpenText TeamSite, Webpop (Saas), many others Related – prototyping (Wix, Weebly), portals

45 Overview – CMS (cont’d)
Why do we need a CMS? Provides numerous features (e.g. site management, managing CSS, etc.) that can be laborious “reinventing the wheel” without them Opens access to shareware/design community providing additional features and themes (e.g., nearly all themes today are responsive) Can provide tools to allow ordinary people to build/add pages to a site without messing everything up What could go wrong? Learning curve, many tough choices (e.g. cloud/hosted, proprietary, open source) Loss of control (you always get more power by using lower-level tools)

46

47

48 Overview of Business Issues
Technology Only “Works” When It is Accepted Has to meet business and user needs, get “buy in” Has to be affordable, doable, on time People have to be able and willing to use it “IT and Organizational Context” - The Information Ecology: Business goals, funding, politics, culture, technology, human resources Context Content Users Audience, tasks, user behavior, experience, vocabulary Data types, content objects, metadata, volume, existing structure

49 IT in the “Real World” What is the Real World?
Anywhere where our work affects profits, social justice, public service, organizational efficiency, … Companies, universities, nonprofits, government services, … Almost anywhere but here! (Not class, not research) What’s the same (between the Real World and our in-class “textbook” experience) Fundamentals (concepts, web technology) Most of the methods (e.g. organization/navigation, card sort, blueprints, wireframes, …) 49

50 The Waterfall Model Requirements Specification Software Test Plan

51 Agile Methods Specification Release Implementation Requirements
Establishment Experience

52 Where to Go From Here Foundations (including this)
INFM600 – Information Environments INFM605 – Users INFM612 - Management Technology (follow-ons) INFM700 – Information Architecture INFM747 – Web Enabled Databases INFM743 – Devel. Of Internet Applications INST733 – Database Design More Management INFM706, INFM620, others More Technology (but not exactly follow-on) INST 631,702, 734, 735-6, 737, 767 52

53 Some Basics about the Final
Overview and Rules Closed book, closed notes You’ll be asked to sign the Honor Pledge You’ll be expected to write directly on the test, but you can use extra (blank) paper if you need to It will be designed to take an hour or less, but you can have more time if you like Types of Questions Almost entirely multiple choice Focus will be on key concepts, though it may not look that way Read very carefully! There may be some short answers, particularly about the projects, but it’s not a rote memory test 53

54 Sample Test Question (Choose The Answer That Fits Best)
93. In writing good HTML, it is important (a) to include a tag, such as <div> or <p>, for each line (b) to use XHTML version 5.0 (c) to avoid including absolute measurements, such as font size and table width, in the body of the HTML (d) to make sure always to have a “submit” element with each form element 94. Your database designer tells you, “I can’t show you my schema yet because I’m not done building the tables”. You respond (a) “The schema is a design document that I need to review and share with the rest of the team before you finish the tables. In what format do you think you can share it?” (b) “Just print out what you’ve done so far” (c) “I’ll finish the tables for you while you work on the schema” (d) “Fine, but I need it done by Friday” 54

55 Sample Test Question (code)
Questions 231 – x refer to the sample of PHP code below $petname = $_REQUEST['petname']; // first query - get the data, ownerID and FoodID from the Pets table if ( !( $result = $database->query ( "SELECT Breed,Eats,OwnerID FROM Pets WHERE Name = '$petname'") ) ) print ("Warning! could not execute query <br />" ); $row = $result->fetch_assoc(); $foodid = $row["Eats"]; $petbreed = $row["Breed"]; $ownerid = $row["OwnerID"]; // Now get the owner info (name, tel. and ) if ( !( $result = $database->query ( "SELECT Name,TelNo, FROM PetOwners WHERE OwnerID = '$ownerid'") ) ) $ownername = $row["Name"]; $ownertelno = $row["TelNo"]; $owner = $row[" "]; 55

56 Sample Test Question (code)
231. You test the form that “posts” to this PHP script and hit the “submit” button. The script seems to execute but the screen is blank – nothing is printed, no errors. Your best next step is: (a) Insert an “else” in the line after each print command, surround the next four lines in curly braces {}, and try it again. (b) Look for a missing semicolon somewhere in the script (c) Check the database using the PHPMyadmin interface to see if the script changed any of the tables (e.g., Pets or PetOwners) (d) Insert print statements such as print(“Owner id is $ownerid<br>”); print(“Owner name is $ownername<br>”); after each query to try to make sure everything is working as expected. 232. One line of the script is $petname = $_REQUEST['petname']; the purpose of this line could be (a) To update the Name field in the Pets table of the database (b) To set the value of the variable $petname to the text string entered in the corresponding form for an <input> element with name = “petname” (c) To create a pull-down menu of pet names from the database (d) To open the petname database 56

57 Questions?


Download ppt "Paul Jacobs The iSchool University of Maryland Thursday, Nov. 17, 2016"

Similar presentations


Ads by Google