Closed morpheus000 closed 8 years ago
That is weird as nothing was changed. I will look into it when I get home later today.
Does this happen when you clear the whole list or only some of the items?
happens in both cases, maybe its something in my setup. 1.3 is the first Version i´ve tested with MySQL so far. i will check an earlier Version.
i tested it with backend v1.0 <- shoppinglist v1.3 and it´s the same.
I checked it and you are right. There is an exclamation mark in line 102 of mysql_connector.php that should not be there.
function deleteMultiple($jsonData)
{
if(empty($jsonData)) {
die(json_encode(array('type' => API_ERROR_MISSING_PARAMETER, 'content' => 'parameter missing for deleteMultiple')));
}
//connect to db
$handler = new mysqli($this->server, $this->username, $this->password, $this->database);
//check if connection successful
if ($handler->connect_error) {
die(json_encode(array('type' => API_ERROR_DATABASE_CONNECT, 'content' => $handler->connect_error)));
}
//iterate over all items in json array
$array = json_decode( $jsonData, true );
foreach($array as $item)
{
//prepare query
$stmt = $handler->prepare("DELETE from ShoppingList WHERE item = ?");
$stmt->bind_param('s', $item['itemTitle']);
//execute query and check if successful
if (!$stmt->execute()){
$result = json_encode(array('type' => API_SUCCESS_DELETE, 'content' => ' Multiple items deleted'));
} else {
$result = json_encode(array('type' => API_ERROR_DELETE, 'content' => $stmt->error));
}
}
Change
if (!$stmt->execute()){
to
if ($stmt->execute()){
and it works.
Please report back if that fixes it. Thanks!
yes fixed it for me :) great work, keep it up!
Glad to hear that:)
Message "Multiple items deleted" not showing up using mysql and Shoppingslist 1.3, list must be synced to make the deleted items vanish.