Need some help here, theres a fatal error when I try to bind.
Call to a member function bind_param() on a non-object.
Please help :(
<?php
$connection = mysqli_connect("localhost","root","","shopp"); //connect to database
if (!$connection){
die('Could not connect: ' . mysqli_connect_errno()); //return error is connect fail
}
$query= $connection->prepare("select * from login where (USERNAME=?,PASSWORD=?");
$username=$_POST['uname'];
$password=$_POST['pass'];
$query ->bind_param('ss',$password,$username);
// To protect MySQL injection for Security purpose
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$rows = mysql_num_rows($query);
if ($rows == 1) {
$_SESSION['login_user']=$username; // Initializing Session
header("location: web.html"); // Redirecting To Other Page
} else {
header("location: loginerror.html");
}
?>
The error is at this line:
$query ->bind_param('ss',$password,$username);