Created
August 2, 2017 02:55
-
-
Save codenoid/179fa85b3f4321f0106768455cc6d349 to your computer and use it in GitHub Desktop.
Super basic PHP Backend Dev
This file contains 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 | |
function db($do) | |
{ | |
// DB Info | |
$servername = "localhost"; | |
$username = "root"; | |
$password = "ayam"; | |
$dbname = "latihan_blog"; | |
// DO Connect | |
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); | |
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // customizing PDO | |
return $conn->prepare($do); | |
} | |
function get($param) { | |
if(isset($_GET[$param])) | |
return $_GET[$param]; | |
else | |
return FALSE; | |
} | |
function post($param) { | |
if(isset($_POST[$param])) | |
return $_POST[$param]; | |
else | |
return FALSE; | |
} | |
w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment