Skip to content

Commit

Permalink
sql refactor, db dump, images
Browse files Browse the repository at this point in the history
  • Loading branch information
entrop- committed Sep 6, 2016
1 parent 317aa66 commit 0080dcb
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 3 deletions.
14 changes: 14 additions & 0 deletions config_expample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* Created by PhpStorm.
* User: entrop
* Date: 06/09/16
* Time: 00:29
*/

define ('DB_HOST', 'localhost');
define ('DB_USER','root');
define ('DB_PASS', 'root');
define ('DB_NAME', 'devox');
define ('GLOBAL_PATH', 'http://devox.dev/');
define ('IMAGE_PATH', 'skin/images/');
4 changes: 1 addition & 3 deletions controller/Controller_Devoxx.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getBeacons(){

//takes last 6 because im too lazy to create sessions
$sql = StructureFactory::getFactory()->pdo();
$query = 'SELECT DISTINCT(color),image FROM beacons ORDER BY id DESC LIMIT 6';
$query = 'SELECT m1.* FROM beacons m1 LEFT JOIN beacons m2 ON (m1.color = m2.color AND m1.id < m2.id) WHERE m2.id IS NULL;';

$q = $sql->prepare($query);
$q->execute();
Expand All @@ -47,6 +47,4 @@ public function getBeacons(){
return $this->serialize($response);
}



}
72 changes: 72 additions & 0 deletions devox.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
-- phpMyAdmin SQL Dump
-- version 4.4.10
-- http://www.phpmyadmin.net
--
-- Host: localhost:3306
-- Generation Time: Sep 07, 2016 at 01:05 AM
-- Server version: 5.5.42
-- PHP Version: 5.6.10

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `devox`
--
CREATE DATABASE IF NOT EXISTS `devox` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `devox`;

-- --------------------------------------------------------

--
-- Table structure for table `beacons`
--

CREATE TABLE `beacons` (
`id` int(4) NOT NULL,
`color` varchar(20) NOT NULL,
`image` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `beacons`
--

INSERT INTO `beacons` (`id`, `color`, `image`) VALUES
(2, 'ice', 'CGI_Jay_ZX.png'),
(3, 'ice', 'elsa-frozen-disney-04.png'),
(4, 'beetroot', 'merida'),
(5, 'beetroot', 'Merida.png'),
(6, 'mint', 'CGI_Jay_ZX.png'),
(7, 'blueberry', 'LloydTechno.png'),
(8, 'candy', 'Cole_ZX1.png'),
(9, 'lemon', '5Pikachu.png');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `beacons`
--
ALTER TABLE `beacons`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `beacons`
--
ALTER TABLE `beacons`
MODIFY `id` int(4) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=10;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ you you want to retrieve json, make GET with any "token" param<br>
like `?token=1`<br>
(note: no matter of value, will return last 6 results every time)

### CONFIG
remove "_example" from file name and insert proper values where needed
Binary file added skin/images/5Pikachu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/CGI_Jay_ZX.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/CGI_Zane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/Cole_ZX1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/Jungle_Kai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/LloydTechno.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/Merida.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/Nyaninjago.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/elsa-frozen-disney-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0080dcb

Please sign in to comment.