Skip to content

Instantly share code, notes, and snippets.

@dmulvi
Last active August 29, 2015 14:02
Show Gist options
  • Save dmulvi/1eb14c22e4c3f3823133 to your computer and use it in GitHub Desktop.
Save dmulvi/1eb14c22e4c3f3823133 to your computer and use it in GitHub Desktop.
The class method that actually returns the LEFT OUTER JOIN results.
/*
* This will pull out our results inserted on Task 1 and display them in a table.
*/
public function pull_twitter_users()
{
try {
$sql = "SELECT f.id, f.screen_name, l.location
FROM followers AS f
LEFT OUTER JOIN location AS l
ON l.id = f.id
LIMIT 100";
$stmt = $this->db->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll();
echo json_encode($result);
}
catch (PDOException $e) {
echo $e->getMessage();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment