1 / 11

INFM 603: Information Technology and Organizational Context

INFM 603: Information Technology and Organizational Context. Session 7 : PHP. Jimmy Lin The iSchool University of Maryland Wednesday, March 12 , 2014. Databases Yesterday…. Databases today…. Wait, but these are websites?. Websites that are really databases.

micah
Download Presentation

INFM 603: Information Technology and Organizational Context

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INFM 603: Information Technology and Organizational Context Session 7: PHP Jimmy Lin The iSchoolUniversity of Maryland Wednesday, March 12, 2014

  2. Databases Yesterday…

  3. Databases today… Wait, but these are websites?

  4. Websites that are really databases • Most of the content is in a database • Web pages are dynamically constructed from results of database queries

  5. Multi-Tiered Architectures Browser Browser Client Server Web Server Web Server “Middleware” Database Database

  6. HTML SQL query CGI Results HTML Putting the Pieces Together… Web Server Browser Database (MySQL) PHP

  7. What is PHP? • PHP is a server-side scripting language • Must run on a server (not in the browser) • More specifically, runs inside the web server • Typical PHP script: • Fetches input from user forms • Executes SQL queries • Constructs an HTML page containing results • Part of the “LAMP” stack • Linux, Apache, MySQL, PHP

  8. PHP Scripts • Are just like normal HTML pages • With the exception of code between <?php … ?> • Variables begin with dollar signs • E.g., $a, $b • Use “echo” to output HTML • Just like document.writeln(…) in JavaScript • Use “.” to concatenate string • E.g., “here is” . “ some text” • Just like “here is” + “ some text” in JavaScript

  9. Sample PHP Script • Get input from user from • Connect to the database • Execute SQL query • Process results to generate HTML

  10. RideShare Exercise • Design a database to match drivers with passengers for ride sharing on long car trips: • Drivers post available seats; they want to know about interested passengers • Passengers come looking for rides: they want to know about available rides and can make reservations • These things happen in no particular order • To simplify, passengers don’t get to post “rides wanted”ads • Build a web application to accomplish the above

  11. RideShare Exercise: Tasks • Design the tables you will need • First decide what information you need to keep track of • Then design tables to capture this information • Design SQL queries • What happens when a passenger comes looking for a ride? • What happens when a driver comes to find out who the passengers are? • Role play!

More Related