Error in php sql statement ($stmt2 is returning false but I dont know why) -
i getting error (call member function bind_param() on non-object ) prepared statement below know means there error in sql statement cannot see error @ all. have been staring @ while , cannot see error, tried echo sql statement , seemed good. please tell me have gone wrong here?
$sql2 = "insert $this->table_1 ($this->key_1, $this->key_2, $this->key_3, $this->key_4, $this->key_5) values (?, ?, ?, ?, ?);"; $stmt2 = $this->connection->prepare($sql2); $stmt2->bind_param("isssi", $1, $2, $3, $4, $5); $stmt2->execute(); $stmt2->close(); thanks
finally found problem, turns out table name "keys" reserved word , escape had use backslashes "``keys`" (ignore second backtick before word, turns code block if there 1 backtick annoyingly). if in future runs problem , sure code correct try , escape column names or table names
Comments
Post a Comment