Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $connect = new mysqli("localhost", "root", "gasamul", "portfolio");
- /* CHECK CONNECTION */
- if (mysqli_connect_errno()) {
- printf("Connect failed: %sn", mysqli_connect_error());
- exit();
- }
- include 'mysql.conf.php';
- if(isset($_POST['submit']) && !empty($_POST['user']) && !empty($_POST['password']))
- {
- if($stmt = $con->prepare("SELECT * FROM admin WHERE user = ? AND password = ?")){ /* PREPARE YOUR QUERY */
- $stmt->bind_param("ss", $_POST['user'], $_POST['password']); /* BIND THESE TWO VARIABLES TO THE QUERY ABOVE RESPECTIVELY; s STANDS FOR strings */
- $stmt->execute(); /* EXECUTE THE QUERY */
- $stmt->store_result(); /* STORE THE RESULT */
- $noofrows = $stmt->num_rows; /* GET THE NUMBER OF RESULT */
- if($noofrows > 0){ /* CHECK IF RESULT IS MORE THAN 0 */
- echo "Login";
- } else {
- echo "Cannot Login";
- }
- $stmt->close(); /* CLOSE THE PREPARED STATEMENT */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement