0

I have this code:

echo "debug 12.1";
$stmmt21 = $conn->prepare("INSERT INTO Together (OneT, TwoT) VALUES (?, ?)");
$UserOne = "netsgets";
$UserTwo = "netsgets2";
$stmmt21->bind_param('ss', $UserOne, $UserTwo);
$UserOne = "netsgets";
$UserTwo = "netsgets2";
$stmmt21->execute();
$stmmt21->store_result();

When I run it i get this error:

Call to a member function bind_param() on boolean

Anant Kumar Singh
  • 68,309
  • 10
  • 50
  • 94

1 Answers1

0

It is because your statement $conn->prepare(... has resulted in some kind of error, which would definitely assign false to $stmmt21. So when you call bind_param(... on $stmmt21, the parser would complain its not allowed on a boolean.

Solution: Please check why is the $conn->prepare() giving you error. Is it due to your connection string, or the INSERT query which you specified.

shahsani
  • 599
  • 7
  • 16
  • how do i see what the error is –  Oct 11 '17 at 05:09
  • So how can i see what the error is? –  Oct 11 '17 at 05:10
  • There a few places to look for. First check if the connection string is okay. You can see this by verifying the connection for any other SQL statement like a `SELECT` query. If that works, check the `INSERT` query you specified in some tool like *phpMyAdmin* to see if the query is okay. – shahsani Oct 11 '17 at 05:33
  • the error says im trying to get a value of a non-object. –  Oct 13 '17 at 17:52