function addFollow($follow) { if (empty($follow)) { return false; } echo $follow; $Cfollow = new Cfollow(); $Cfollow->addFollowSQL($follow); }
var $id; function __construct() { $this->id = $_SESSION["id"]; } function Mefollower() { $connexion = \App\Model\Database::get()->prepare("\n\t\t\tSELECT *,count(follow_id) AS nbrFollow\n\t\t\tFROM `tp_follow` INNER JOIN tp_users\n\t\t\tON tp_follow.follower_id = tp_users.id\n\t\t\tWHERE follow_id = '" . $this->id . "'"); $connexion->execute(); $data = $connexion->fetchAll(); return $data; } function Mefollow() { $connexion = \App\Model\Database::get()->prepare("\n\t\t\tSELECT *\n FROM tp_follow\n INNER JOIN tp_users ON tp_follow.follow_id = tp_users.id\n WHERE follower_id = '" . $this->id . "'\n "); $connexion->execute(); $data = $connexion->fetchAll(); return $data; } /* * Rajoute un follow dans la database */ function addFollowSQL($follow) { $connexion = \App\Model\Database::get()->prepare("\n\t\t\tINSERT INTO tp_follow (follow_id,follower_id)\n\t\t\tVALUES ('" . $follow . "','" . $_SESSION["id"] . "') "); $connexion->execute(); } } $Cfollow = new Cfollow(); $Mefollower = $Cfollow->Mefollower(); // $CountMefollow = $Cfollow->CountMefollow();