mysql - php login verification returns 500 (Internal Server Error) -
i trying learn php , have issue in verifying login attempt mysql database. whenever try run script 500 (internal server error).
the server configured correctly , every other file working fine. have tried increasing php memory limit, no luck. google tells me must error in php, not see it. can tell me doing wrong?
my login.html:
<!doctype html> <html> <head> </head> <body> <form action="loginverification.php" method="post"> <table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> <td>username:</td> <td><input name="username" type="text"></td> <td></td> </tr> <tr> <td>password:</td> <td><input name="password" type="text"></td> <td></td> </tr> <td></td> <td></td> <td><input type="submit"></td> </tr> </tbody> </table> <br> </form> </body> </html> and loginverification.php:
<?php $dbhost = ''; $dbuser = ''; $dbpass = ''; $dbname = ''; $port = ''; $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname, $port); if (mysqli_connect_errno()) { printf('could not connect: %s\n', $mysqli_connect_error); exit(); } else { echo "success"; } $username = $_post['username']; $password = $_post['password']; $results = "select * login username=? , password=?"; $stmt = $mysqli->prepare($results); $stmt->bind_param("ss", $username,$password); $stmt->execute(); if($results->fetch() == false) { error_log("user $username: password doesn't match."); echo '{"success":0,"error_message":"invalid username/password"}'; } else { echo '{"success":1}'; } mysqli_close($mysqli); ?> i working on azure, php 5.4.
you trying call fetch() method on $results in code string. have use statement ($stmt).
have fun learning!
Comments
Post a Comment