{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture7 - CSE 135 Server Side Web Languages Lecture 7...

Info icon This 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
Image of page 1

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

View Full Document Right 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
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
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right 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) Login Char(16) Password Char(16) User Table User_id First_name Last_name Login Password 347 Moe Howard bossman Whyyou!
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern