0

Using this insert-script:

$stmt = $mysqli->prepare("INSERT INTO table VALUES (?)");
$stmt->bind_param('s', $value); // echoing $value: 120.120
$stmt->execute();
$stmt->close();
$mysqli->close();

I get this error:

 Call to a member function bind_param() on a non-object 

i already tried "s", "d" and "i" but none works, anybody could help me? greetings!

user2999787
  • 617
  • 1
  • 5
  • 11

1 Answers1

0

The problem generally occurs because

$mysqli->prepare("INSERT INTO table VALUES (?)");

Does not return an object which means that prepare() failed to apply your definitions.

I used to see the bind_param non-object error when the actual SQL table did not actually have the field i wanted to write to. Please compare your query to your actual SQL table and see if all the fields you try to use are actually part of the table. Also make sure the table name is correct.

SquareCat
  • 5,699
  • 9
  • 41
  • 75