1
0
mirror of https://github.com/owncloud/bookmarks.git synced 2024-12-02 06:24:11 +01:00

When deleting a bookmark, remove its tags from database.

This commit is contained in:
Golnaz Nilieh 2011-08-20 12:38:15 +04:30
parent 00d398a549
commit 2c9d4bb403

View File

@ -35,18 +35,33 @@ if( !OC_User::isLoggedIn()){
exit();
}
$query = OC_DB::prepare("
DELETE FROM *PREFIX*bookmarks
WHERE url LIKE ?
AND user_id = ?
");
$params=array(
urldecode($_GET["url"]),
OC_User::getUser()
);
$result = $query->execute($params);
$query = OC_DB::prepare("
SELECT id FROM *PREFIX*bookmarks
WHERE url LIKE ?
AND user_id = ?
");
$id = $query->execute($params)->fetchOne();
$query = OC_DB::prepare("
DELETE FROM *PREFIX*bookmarks
WHERE id = $id
");
$result = $query->execute();
$query = OC_DB::prepare("
DELETE FROM *PREFIX*bookmarks_tags
WHERE bookmark_id = $id
");
$result = $query->execute();
// var_dump($params);
echo json_encode( array( "status" => "success", "data" => array()));