I've a table called "projects" :
and one other called "user_to_project" that defined which user follow wich projects (in this example, the "user_id" 1 follow "project_id" 2,3)
I'm looking for a function to display all the project following by an user. I was thinking something like this :
function getUserProjects($user_id){
global $db;
return $db->query('SELECT * FROM `projects` INNER JOIN `user_to_project` ON (`user_to_project`.`project_id` = `user_to_project`.`user_id`) WHERE `user_to_project`.`user_id` = ' . (int)$user_id );
}
But it doesn't work...