Select query Within a Select Query? Novice needs help

Hello, I’m creating a site at the moment that is currently using 3 tables in a database, “news”, “users”, and “photos”.
What I’m trying to do is display a news article with the author and a picture of the author.
I want to do this by selecting the userId that matches the authorId from each news item. Once the userId is fetched i then want to fetch the relevant picture from the photos table based on the users photoId.
I’m probably not explaining this clearly enough so here’s the code that I’ve written.


<?PHP
$news = mysql_query("SELECT * FROM news ORDER BY timedate");
while($output = mysql_fetch_assoc($news)){
      $author = "SELECT username, photoId FROM users WHERE id =". $output['author'];
      $photo = "SELECT url FROM photos WHERE id =". $author['photoId'];
?>
     <a href="users/<? echo $author['username']; ?>"><img src="<? echo $photo; ?>" /></a>
<?PHP 
     //display everything else
}
?>

As you can see I’m no expert, a complete novice infact and I’m sure there’s a simple reason why this would not work, it’s just how i though It might work (I’m teaching myself to code at the moment).
I’ve searched far and wide for an answer, with no help. Maybe the problem is that I’m not exactly sure what to search for.
If anyone wouldn’t mind showing me a correct way to do this and possibly explaining where I went wrong I would greatly appreciate it. Thanks for your time,

Nick