Multi layer architecture SQL ACID properties Atomic -- The transaction runs completely or not at all Consistent -- Each transaction moves from one consistent state to another Independent -- Every transaction runs as if it were the only one on the system Durable -- Data changes survive hardware and software failure. Abort Table vs database create table schema not null primary key types decimal(5,2) date and time types enum blob/longblob update tablename set columnname = value where ... delete from tablename where ... select columnname from tablename where .. order by columname limit 3 alter table ... drop tablename describe table tablename joins nested queries (and in vs =) min and max count and average and group by insert into tablename values ( ...) database decomposition might cost speed reduces redundency and possibility of inconsistency Indexes PHP Built in arrays $_GET $_POST $_COOKIE $_SESSION $_REQUEST Error supression with @ isset($varname) empty($varname) Error checking with die Arrays Not really arrays indexed by key, which can be string not always the same type foreach ($array as $item) foreach($array as %key => $item) Cookies Uses session cookies vs cookies with an expire time limits on size limits on domain/hostname Can be turned off $_COOKIE Session variables $_SESSION Needs cookies No reasonable size limits Expires when the session does Allows for privacy Requires cookies Loops while loops for loops foreach($array as $value) foreach($array as $index => $value Functions default arguments Objects __construct __tostring $this->thing $this->method() vs method() class vs local vs global variables print_r header("location: ...") Variables global superglobal $_REQUEST $_COOKIE $_POST $_GET Databases Know some way to fetch data like mysqli_query mysqli_num_rows mysqli_fetch_row mysqli_connect mysqli_select_db real_escape_string Error checking Regular Expressions end of line chars ^ and $ Repeat chars * and + Maybe char ? Sets of chars [abc] and [^abc] Ranges of chars [a-z] Special sets like /s and /S Login Pick random number Verify random number passwords always encrypted! Know this is vulnurable to snoop attack