Created
May 19, 2015 11:55
-
-
Save ineentho/b0cac67e6e2a288de774 to your computer and use it in GitHub Desktop.
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 | |
$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', 'sten123'); | |
function create_user($username, $password) { | |
global $dbh; | |
$loginStmt = $dbh->prepare('INSERT INTO users (username, password) VALUES(:username, :password)'); | |
$loginStmt->bindValue(':username', $username); | |
$loginStmt->bindValue(':password', $password); | |
return $loginStmt->execute(); | |
} | |
$success = create_user('Ineentho', 'sten123'); | |
if ($success) { | |
echo 'User created'; | |
} else { | |
echo 'User could not be created'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment