0
你好,大家好我有兩個幾乎相同的querys但一個是工作,一個不 這一個是工作的罰款:MySQL查詢不工作給予和錯誤
<?php
require 'mysql.php';
if(isset($_POST["email"])){
$email = $_POST["email"];
$stmt = $connect->prepare("SELECT email FROM users WHERE email=? ");
$stmt->bind_param("s", $email);
$stmt->execute();
$result = $stmt->get_result();
$rowcount = $result->num_rows;
if ($rowcount > 0){
echo "1";
} else if($rowcount == 0){
echo "0";
}
}
?>
和這個人是不工作,給我一個錯誤
" Fatal error: Call to a member function bind_param() on a non-object in line 8 "
<?php
session_start();
require 'mysql.php';
$userid = $_SESSION["userid"];
$stmt = $connect->prepare("SELECT * FROM character WHERE userid=? ");
$stmt->bind_param("i", $userid); // line 8
$stmt->execute();
$result = $stmt->get_result();
$rowcount = $result->num_rows;
if ($rowcount > 0){
echo "1";
}else{
echo "0";
}
?>
他們幾乎相同的僅第一個檢查電子郵件,這一個檢查的用戶ID,但第二個不工作,第一個工作正常問題出在哪裏???
是用戶ID = 1 – yahoo5000
這回答沒什麼變化,我用?所有的時間對我來說工作正常 – yahoo5000