For they who know PHP/MySQL: Is there a better way?

Here’s the thing: I’m doing an internship over at William and Mary this summer after one year of Computer Science at Virginia Tech, and it is fairly cool. However, one of my duties is working on an online bibliography for the classics department. This entails learning PHP, MySQL, and HTML.
Now, there exists another similar database that I have cribbed from extensively for the adding of data entries, and I am reasonably sure that I can figure out how to display them once I get them back, but the actual MySQL query is giving me fits.
The thing is that there are three search options: Title, Author, and Keywords. The keywords and the authors are stored in seperate SQL tables, with an additional table each linking the appropriate keyword/author to the primary key of the relavent bibliography entry. Given this, how the hell do I design the relavent query in PHP? The only thing that I can think to do is set up six seperate queires depending on whether 1, 2, or 3 search terms are used, but that will entail increasing my debugging by six-fold, not to mention being a bitch to write. I’m not pressed for time (this internship is a volunteer thing, and this project has been in Limbo for a year) and can probably do the 6 seperate entries, but would prefer to find a more elegant solution. I’ve browsed php.net and mysql.com, but as I’m not sure what I’m even looking for (besides a better way), they have not been as helpful as they were when I was puzzling out syntax.
Does anyone see one, or know where I should be looking?

You should be able to do it with one query, substituting various variables for the search terms:


$query = 'SELECT $key FROM '.$sql->tbl_prefix.'boards WHERE $searchtype = $searchvalue';
$sql->query($query);