This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $md = " | |
| hej | |
| # Rubrik 1 | |
| hej hej | |
| ## underrubrik |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Adminer 4.2.3 MySQL dump | |
| SET NAMES utf8; | |
| SET time_zone = '+00:00'; | |
| SET foreign_key_checks = 0; | |
| SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; | |
| CREATE DATABASE `bikerental` /*!40100 DEFAULT CHARACTER SET latin1 */; | |
| USE `bikerental`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $db = mysqli_connect("localhost","root","root","todo"); | |
| mysqli_query($db,"SET NAMES utf8"); | |
| $query = "INSERT INTO items (title) VALUES ('{$_GET['title']}')"; | |
| $result = mysqli_query($db, $query); | |
| echo json_encode(["id" => mysqli_insert_id($db), "title" => $_GET['title']]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # | |
| # Den här klassen startar upp vårt API och hämtar allt det vi behöver från själva HTTP-anropet | |
| # | |
| class API{ | |
| private $method, // GET, POSt, PUT, DELETE ... | |
| $input, // Data sent with request | |
| $resource, // REST Resource to call |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* ======================= | |
| == GET REQUEST STUFF | |
| In this section of the code we get all the parts of the HTTP request to handle if and do the right stuff in the backend. | |
| ======================= */ | |
| // GET THE REQUEST METHOD | |
| $method = $_SERVER['REQUEST_METHOD']; |