having a little trouble with a query that I'd like to keep to just one query. Basically, I have two tables, users, and relationships. Users have an ID, the relationships table has user_a and user_b fields which contain users.id values, which matches users up as 'user_a follows user_b'.
Now I'm hitting the Twitter API to pull in user_a's followers (https://dev.twitter.com/docs/api/1/get/friends/ids) but people in the users table are people attending an event, and not necessarily in user_a's friends. I need to execute an INSERT in the relationships table if user_b exists in the users table.
Here's what I have so far!
$json = file_get_contents('https://api.twitter.com/1/friends/ids.json?cursor=-1&user_id=' . $this->_attendee->id);
$response = json_decode($json);
if($response->ids){
foreach($response->ids as $friend){
// query goes here
}
}