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.

Name: user_friends_count_refactored fullscreencopyrawdownloadembedprint


Your result can be seen below.

Result of php executing





Full code of user_friends_count_refactored.php

  1. <?php
  2. function cot_social_remove_friend($userid, $friendid)
  3. {
  4.         $db->delete($db_cot_social_friendslist, " (userid = $userid AND friendid = $friendid) OR (userid = $friendid AND friendid = $userid) ' LIMIT 1");
  5.         $ids = $userid . ', ' . $friendid;
  6.         $db->query("UPDATE $db_users SET user_friends_count=user_friends_count-1 WHERE user_id IN (' . $ids . ')");
  7. }
  8.  
File Description
  • user_friends_count_refactored
  • PHP Code
  • 24 Jun-2021
  • 377 Bytes
You can Share it: