I am by no means a MySQL expert. I am only learning as I go along. I have gotten to the point where I have made a relational database: where the main table indexes repetitious data from other tables. I am trying to figure out a way to display several different results from one query. For the sake of my client's anonymity, let's think about this database as authors and quotes.
I would like to pop up a modal box that shows all the quotes of one author when clicking a link. So here are two tables in my database: one, "quotes", and one "authors". I have indexed the primary key in my authors to my quotes. Let's say we have five quotes from Shakespeare (ID=1 in "authors") and five quotes from Wilde (ID=2 in "authors"). I can easily create a separate query such as this:
$query_shakes ="SELECT quotes.quotes, quotes.auth_id, authors.auth_id, authors.authors WHERE quotes.auth_id = authors.auth_id AND authors.auth_id = 1";
... and so on.
The trouble is, I actually have 16 authors and almost a hundred quotes. It seems to be overkill to write a separate query for each author. Can't I simply use the query above without the "AND ..." part and then inject it later as a variable or something with the link?
Does what I am trying to do make sense? Can someone point me in the right direction?