我有一份聲明中剛剛學到的幾個小時前,但我總是得到的回報0哪些錯誤與此準備好的聲明
$ip = $data
$stmt = $mysqli->prepare("SELECT counter_ip
FROM counter_out
WHERE counter_ip = ?");
$stmt->bind_param('s', $ip);
$stmt->execute;
$stmt->bind_result($r_ip);
$stmt->fetch();
echo "<pre>";
echo $r_ip;
echo "</pre>";
bind_result我嘗試了所有IDBS, 但是,當我做沒有準備好的聲明中這樣它的工作原理
$sql = "SELECT counter_ip
FROM counter_out
WHERE counter_ip = '$ip'";
$result = $mysqli->query($sql);
$dupecheck = $result->fetch_assoc();
echo "<pre>";
echo $dupecheck[counter_ip];
echo "</pre>";
準備好的聲明中有錯誤嗎?
我猜''stmt->執行;'是一個錯字?應該是'$ stmt-> execute();' – jishi