I have the following PHP code to write an INSERT SQL query to use in my Flex application:
public function createShoppinglist($item) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (name, addedBy) VALUES (?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ss', $item->name, $item->addedBy);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
}
However, when I try to bind it to an object (button) in my Flex application, I get the following error message:
Warning: Attempt to modify property of non-object in C:\wamp\www**\services*.php on line 121
Line 121 in this case would be:
mysqli_stmt_bind_param($stmt, 'ss', $item->name, $item->addedBy);
Could anyone tell me what this means? Why is this failing? I've tried changing the variables in the PHP statement but that doesn't really do anything.