friend_search - 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.



Your result can be seen below.

Result of php executing





Full code of friend_search.php

  1. <?php
  2. function cot_social_check_friend($userid, $friendid)
  3. {
  4.         global $db, $db_cot_social_friendslist;
  5.         $sql1 = $db->query("SELECT * FROM $db_cot_social_friendslist WHERE userid = $userid AND friendid = $friendid LIMIT 1");
  6.         $friendsExist1 = $sql1->rowCount();
  7.         $sql2 = $db->query("SELECT * FROM $db_cot_social_friendslist WHERE userid = $friendid AND friendid = $userid LIMIT 1");
  8.         $friendsExist2 = $sql2->rowCount();
  9.         if($friendsExist1 > 0){$active = $sql1->fetch();}
  10.         if($friendsExist2 > 0){$active = $sql2->fetch();}
  11.         if($friendsExist1 > 0 || $friendsExist2 > 0)
  12.         {
  13.                 return true;
  14.         }
  15.         else
  16.         {
  17.                 return false;
  18.         }
  19. }
  20.  
File Description
  • friend_search
  • PHP Code
  • 24 Jun-2021
  • 617 Bytes
You can Share it: