Hello,

I'm writing an application thats coming along well, but I'm having problems with a query. I have two tables both have a ID field set to primary key auto increment. How do I query both Id's to display both if needed. Heres my page:

topic_list.php
PHP Code:

<?php
//connect to the database
$dbcnx mysql_connect('localhost','jive','zeroone');
$bookconnect mysql_select_db('bookwriter');
//query chapters and topics db to display the chapter/topic text
$chapID $_GET['chapID'];
$topiclist mysql_query("SELECT chap_title, topics.ID, topic_title, topic_text
FROM chapters, topics
WHERE chap_ID = chapters.ID AND
chap_ID = 
$chapID) or die(mysql_error());


if(
$topiclist) {
echo (
'connected');
}
else {
echo (
'not connected somethings wrong with the query');
}


//create the topic array in the while loop
while($topic mysql_fetch_array($topiclist)) {
$chapter_title $topic['chap_title'];
$topic_title $topic['topic_title'];
$topic_text $topic['topic_text'];
$topic_ID $topic['topics.ID'];
//display the topics of the chosen chapter
echo("<table>
<tr>
<td><a href="
topic_form_edit.php">$topic_ID $topic_title</a></td>
</tr>
</table>" 
);
echo(
$topic_ID);
}
?>
I want to be able to query both chapters.ID and topics.ID to I can list them both and pass the topics.ID in a query string to update the topic.

any ideas.