note 113331 added to mysqli-stmt.store-result
| From: | ccherese at yahoo dot com | Date: | Sat, 28 Sep 2013 04:04:37 +0000 |
| Subject: | note 113331 added to mysqli-stmt.store-result | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196397@lists.php.net to get a copy of this message | ||
Can someone help me with my code, i've already stored the results before calling num_rows but
still it would give me a 0 answer. For testing purposes, i've tried to echo store_result to see
if something is being store, it gives out 1 so it's fine but when i tried to echo num_rows, the
answer is 0...why?
can someone help me?
$con = mysqli_connect("localhost", "root", "", "pamsignup")
or die('error in connection'.mysqli_connect_error());
error_reporting(E_ALL);
if(isset($_POST['login']))
{
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$con = mysqli_connect("localhost", "root", "",
"pamsignup");
$sql = "SELECT 1 FROM registries WHERE username=? AND password=?";
$stmt = mysqli_prepare($con, $sql);
mysqli_stmt_bind_param($stmt, 'ss', $_POST['username'],
$_POST['password']);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
if(mysqli_stmt_num_rows($stmt) == 1)
{
header('Location: PAM-home.php');
mysqli_stmt_free_result($stmt);
}
else
{
//header('Location: PAM-login.php');
echo 'Wrong Password';
}
mysqli_stmt_close($stmt);
}
----
Server IP: 69.147.83.199
Probable Submitter: 112.207.192.105
----
Manual Page -- http://php.net/manual/en/mysqli-stmt.store-result.php
Edit -- https://master.php.net/note/edit/113331
Del: integrated -- https://master.php.net/note/delete/113331/integrated
Del: useless -- https://master.php.net/note/delete/113331/useless
Del: bad code -- https://master.php.net/note/delete/113331/bad+code
Del: spam -- https://master.php.net/note/delete/113331/spam
Del: non-english -- https://master.php.net/note/delete/113331/non-english
Del: in docs -- https://master.php.net/note/delete/113331/in+docs
Del: other reasons-- https://master.php.net/note/delete/113331
Reject -- https://master.php.net/note/reject/113331
Search -- https://master.php.net/manage/user-notes.php