lecture7

Lecture7 - CSE 135 Server Side Web Languages Lecture 7 Database Driven Sites mySQL PHP and MVC Overview Friday August 6 2010 CSE 135 Server Side

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 135 Server Side Web Languages Lecture # 7 Database Driven Sites - mySQL, PHP, and MVC Overview Friday, August 6, 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 135 Server Side Web Languages Lecture # 7 DB Driven Sites Rather than storing the content of our Web site directly within files it may be better to store the content within a datastore (XML files, Database tables, etc.) We will then pull out the desired data from the database and combine it with HTML markup and CSS in the form of a template to create a complete page • Separation of code, presentation, and data is a good aim – though not unique to server-side dev. The DB driven site provides for the possibility of dynamic or even personalized pages • User preferences, promotions in e-commerce, custom reports, portals, etc. DB driven sites also afford us the opportunity to build content management systems (CMS) Important Idea – When do you build the pages in a DB driven site? • As they are requested? Before they are requested? • Your ability to prebuild pages is determined by how variable the content is. Avoid the dynamic-static trap if possible Friday, August 6, 2010
Background image of page 2
CSE 135 Server Side Web Languages Lecture # 7 The pieces of the DB Driven Site • The DB Oracle, MS SQL Server, Sybase, DB2, mySQL, etc. • Middleware / Programming Environment PHP, CGI/Perl, ASP/ASP.NET, CFM, JSP, etc. • APIs and Drivers for DB Connectivity Abstracting away the DB and specific concerns • Question: How often will the data store change? Specifics • ODBC, native drivers • ADO.NET, JDBC The mapping between table relations and objects also may be handled here • Separate Templating Environment May be part of the middleware programming environment Friday, August 6, 2010
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 135 Server Side Web Languages Lecture # 7 An Approach • User driven – UI first • Data driven – Tables and data first • Top down vs. bottom up? Friday, August 6, 2010
Background image of page 4
CSE 135 Server Side Web Languages Lecture # 7 Step 1: Model Your Data First determine what are the types of data that your application is going to keep track of Consider a table to hold user information we might have a login, password, first name, last name, and other descriptive data to keep track of our users We need to assign data types to each type of information we track • Common data types: CHAR(LENGTH), VARCHAR(LENGTH), TEXT, MEDIUMTEXT, LONGTEXT, SMALLINT,MEDIUMINT, INT, FLOAT, DATA, DATETIME, ENUM Notice that emphasis is placed upon the precision of the information stored • For good reason we want accuracy and we don’t want to waste space! We usually need to specify a primary key that is unique so that we can keep track of data properly Friday, August 6, 2010
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 135 Server Side Web Languages Lecture # 7 Step 1: Model Your Data • It is often easier to visualize the data like so • We could imagine a filled in set of data looking something like User_id (primary) MEDIUMINT First_name Varchar(35) Last_name Varchar(35)
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/10/2010 for the course CSE CSE135 taught by Professor Powell during the Summer '10 term at UCSD.

Page1 / 57

Lecture7 - CSE 135 Server Side Web Languages Lecture 7 Database Driven Sites mySQL PHP and MVC Overview Friday August 6 2010 CSE 135 Server Side

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online