为什么我一直收到致命错误:使用此代码调用非对象的成员函数prepare()

时间:2015-02-11 23:41:38

标签: php mysql

<?php
include('db_conx.php');
$username= $_POST ['username'];
$password= $_POST ['password'];
//Test:
echo "<h1>Username: $username</h1>";
echo "<h1>Password: $password</h1>";
$mysqli=new mysqli       
    ('localhost','1800758_robbie','mypassword', '1800758_robbie');
$stmt=$conn->prepare("SELECT username, password FROM  
    1800758_robbie.users3 WHERE username=? AND password=? LIMIT 1");
$stmt->bind_param('ss', $username,$password);
$stm->execute();
$stmt-> store_result();
$res=$stmt->num_rows();
if($res == 1) {echo "You have successfully logged in.";}else{echo " the 
    username and password you've supplied is not valid.";}
?>

我曾尝试阅读其他几篇文章,但没有一篇与此代码相符。我很遗憾为什么我不断收到此错误消息。我想要做的就是为论坛创建一个成功的登录页面。顺便说一下,我的所有登录信息都是正确的。

0 个答案:

没有答案