1

I'm getting this error and i can't fix it. Could someone be very kind and explain to me what it means? Also, how I can fix it? I've tried researching into it however I don't understand it. The code is trying to get the value of multiple html inputs/select tags and use as an sql query.

$db = new mysqli("host", "username", "password", "dbname");
$input = $_GET['input']; 
$topic = $_GET['topic']; 
$location = $_GET['location'];  inserted into the query
$combined = $input . $topic . $location;
$terms = explode(" ", $combined);
$stmt = $db->prepare('SELECT * FROM search WHERE `input` = ? AND `topic` = ? AND `location` = ?');
$stmt->bind_param("sss", $input, $topic, $location);
$stmt->execute();
$stmt->close();
tadman
  • 208,517
  • 23
  • 234
  • 262
user2379090
  • 125
  • 1
  • 3
  • 11
  • 2
    It's telling you that `$stmt` isn't what you think it is. Try `var_dump($stmt)` to see what `prepare()` is actually returning. – andrewsi Jul 11 '14 at 16:34
  • As per the zillions of dupes on this site, your prepare failed, you failed to check for success, and are using a the boolean FALSE of that error as if it was an object. – Marc B Jul 11 '14 at 16:35
  • Probably you have something wrong in your query, then its returning false to $stmt var – hlscalon Jul 11 '14 at 16:36
  • I tried `var_dump($stmt)` and the prepare() returned false, again I'm new to PHP and I'm throwing myself in the deep end here. – user2379090 Jul 11 '14 at 16:51

0 Answers0