user_friends_count_refactored - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of user_friends_count_refactored.php
- <?php
- function cot_social_remove_friend($userid, $friendid)
- {
- $db->delete($db_cot_social_friendslist, " (userid = $userid AND friendid = $friendid) OR (userid = $friendid AND friendid = $userid) ' LIMIT 1");
- $ids = $userid . ', ' . $friendid;
- $db->query("UPDATE $db_users SET user_friends_count=user_friends_count-1 WHERE user_id IN (' . $ids . ')");
- }