Displaying the Topic List

Now that you have a topic and at least one post in your database, you can display this information and let people add new topics or reply to existing ones. In Listing 19.3, we take a step back and create a topic listing page. This page will show the basic information of each topic and provide the user with a link to add a new topic; you already have the form and script for that. This script would actually be an entry page for your forum.

Listing 19.3. Topic Listing Script
 1: <?php 2: //connect to server and select database 3: $conn = mysql_connect("localhost", "joeuser", "somepass") 4: or die(mysql_error()); 5: mysql_select_db("testDB",$conn) or die(mysql_error()); 6: 7: //gather the topics 8: $get_topics = "select ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.