Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanhamlin/academy-php
Code for the Catalyst academy students
https://github.com/seanhamlin/academy-php
Last synced: 12 days ago
JSON representation
Code for the Catalyst academy students
- Host: GitHub
- URL: https://github.com/seanhamlin/academy-php
- Owner: seanhamlin
- Created: 2014-01-09T20:16:00.000Z (about 11 years ago)
- Default Branch: 2015-php
- Last Pushed: 2015-01-08T03:49:23.000Z (about 10 years ago)
- Last Synced: 2024-11-07T22:06:31.344Z (2 months ago)
- Language: PHP
- Size: 290 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Catalyst IT academy
===================Here is the complete code for the PHP tutorial. This should serve as an
introduction to PHP, but is not meant to be secure code. There are numerous
exploits in the code ;)Database restore
----------------$ mysql -u root
DROP DATABASE IF EXISTS movie;
CREATE DATABASE movie;
CREATE USER movie@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON movie.* TO movie@localhost;
\q$ mysql -u movie -p movie
CREATE TABLE movies (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL UNIQUE,
length INTEGER
);CREATE TABLE people (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL UNIQUE
);CREATE TABLE votes (
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
person_id INTEGER NOT NULL ,
movie_id INTEGER NOT NULL,
CONSTRAINT person_fk FOREIGN KEY (person_id) REFERENCES people(id),
CONSTRAINT movie_fk FOREIGN KEY (movie_id) REFERENCES movies(id),
CONSTRAINT votes_once UNIQUE (person_id, movie_id)
);Add a new movie
---------------$ mysql -u movie -p movie
INSERT INTO `movie`.`movies` (`id`, `name`, `length`) VALUES (NULL, 'The Matrix', '150');
INSERT INTO `movie`.`movies` (`id`, `name`, `length`) VALUES (NULL, 'The Matrix Reloaded', '138');
INSERT INTO `movie`.`movies` (`id`, `name`, `length`) VALUES (NULL, 'The Matrix Revolutions', '129');Add a new person
----------------$ mysql -u movie -p movie
INSERT INTO `movie`.`people` (`id`, `name`) VALUES (NULL, 'Alice');
INSERT INTO `movie`.`people` (`id`, `name`) VALUES (NULL, 'Bob');
INSERT INTO `movie`.`people` (`id`, `name`) VALUES (NULL, 'Charlie');