Created
July 11, 2016 09:12
-
-
Save a1exlism/1e9cacc86bdf51f81d7dec141f84b208 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
From:http://www.ahlinux.com/php/12992.html | |
<?php | |
//Example_1 | |
$query = sprintf("SELECT * FROM Users where UserName='%s' and Password='%s'", | |
mysql_real_escape_string($Username), | |
mysql_real_escape_string($Password)); | |
mysql_query($query); | |
//Example_2 | |
$db = new mysqli("localhost", "user", "pass", "database"); | |
$stmt = $mysqli -> prepare("SELECT priv FROM testUsers WHERE username=? AND password=?"); | |
$stmt -> bind_param("ss", $user, $pass); | |
$stmt -> execute(); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment