0

I have 1 variable called $ip that is the IP address who entered my site. and I want to find banned states from $ip in the SQL database.

I have used this code but didnt work:

$state = $mysqli->prepare('SELECT bannedstate FROM `unbanned` WHERE ip=?');
$state->bind_param("b", $bannedstate);
$state->execute();
$state->bind_result($Selectedbannedstate);
$state->fetch();

All help will be appreciated

Ganesa Vijayakumar
  • 2,216
  • 5
  • 23
  • 40

1 Answers1

-1

You try to bind your $bannedstate to the parameter "b" which isn't in your statement. I think it should be something like this

$state = $mysqli->prepare('SELECT bannedstate FROM `unbanned` WHERE ip=:b');
$state->bind_param(":b", $bannedstate);
$state->execute();
$state->bind_result($Selectedbannedstate);
$state->fetch();
Nylock
  • 24
  • 6