12
THE WEBMASTERS: SENG + WAVERING

THE WEBMASTERS: SENG + WAVERING. On account of construction, we will be having class in room 1248 next week

Embed Size (px)

Citation preview

Page 1: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

THE WEBMASTERS: SENG + WAVERING

Page 2: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week
Page 3: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

On account of construction, we will be having class in room 1248 next week.

Page 4: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

We have used variables to store information for our websites to use. How do we store information for websites to use even when people close their browsers and sign off?

Page 5: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

Databases!Allow for persistent storage of data

Page 6: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

Databases are a way to store information without relying on Javascript or PHP variables.

A database is a table of objects – like an spreadsheet.

Columns define attributes of an object

Each row is a separate object

Page 7: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

SQL – Structured Query LanguageA way of talking to a database which

lets us implement CRUDCRUD – the four basic functions of

persistent storage: Create, Retrieve, Update Delete

Page 8: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

Combine basic commands and elements to form clauses

Clauses combine to form statementsUse phpMyAdmin to work with

databaseshttp://demo.phpmyadmin.net/trunk-c

onfig/

Page 9: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

CREATE DATABASE WebshipUSE WebshipCREATE TABLE studentsDefine columnsSELECT * FROMMany other commands!

Page 10: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

We will still use Javascript and PHP variables – need some way to take information from database and use it to create a webpage.

Page 11: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

Can send SQL queries to database with PHP

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

Can assign PHP variables as the results returned from MySQL queries

$variable = mysql_query("SELECT * FROM example")

Page 12: THE WEBMASTERS: SENG + WAVERING.  On account of construction, we will be having class in room 1248 next week

$query = "INSERT INTO students VALUES (’Albert',’[email protected]’);

mysql_query($query);