D
D
del9937882016-03-25 17:32:45
PHP
del993788, 2016-03-25 17:32:45

How to remove all bookmarks from the database?

Hello. This query displays all bookmarks of an authorized user:

$user_id = intval($_GET['user_id']);
$USER = $db->super_query("SELECT * FROM " . USERPREFIX . "_users WHERE user_id='{$user_id}' ");
echo $USER['favorites'];

Help build a query that clears the value of 'favorites'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AlikDex, 2016-03-25
@del993788

Of course, you need to check whether the user is the owner of the bookmarks.
Something like:

$user_id = intval($_GET['user_id']);
if ((int)$member_id['user_id'] === $user_id ) {
    $db->query( "UPDATE `" . USERPREFIX . "_users` SET `favorites`='' WHERE `user_id`='{$user_id}'" );
}

K
Kocmoc, 2016-03-25
@kocmoc941

$USER = $db->super_query("UPDATE TABLE" . USERPREFIX . "_users SET favorites='' WHERE user_id='{$user_id}' ");
??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question