I created a table
CREATE TABLE basket (id INT NOT NULL AUTO_INCREMENT, item VARCHAR(50) NOT NULL, amount VARCHAR(50) NOT NULL);
and try to create an insert function:
public function add_basket_item() {
include '../vo/basketVO.php';
$stmt = mysqli_prepare($this->connection, "INSERT INTO basket (item, amount) VALUES (?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ss',$item->item, $item->amount);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
}
But when I try to test the operation in Flex Builder I get the following error:
InvocationTargetException:There was an error while invoking the operation. Check your server settings and try invoking the operation again.
Reason: Server error MySQL Error - 1048: Column ‘item’ cannot be null /…/services/DBBase.php on line 26
I have tried various things but just can’t get it to work. Any help would be much appreciated.