Threaded Discussion with PHP/MySQL
 
SEARCH: webmonkey  the web

 
PHP
-------------------------
Print
this article for free. 
-------------------------

Pages:
1  Put PHP to Work
2 Code Overview
3 Top-Level Topics
4 Topic Details
5 The Reply

Threaded Discussion with PHP/MySQL
by Brad Bulger 28 Jul 1999

Brad Bulger [an error occurred while processing this directive]has done many things for Wired over the years that he'd rather not go into right now. He wants to know when the future is going to get here.

Page 1

If you're a regular reader of Webmonkey, you already know that there's plenty you can do with PHP. You can make images on the fly, design some nifty site navigation, or make a database-driven site. In his tutorial, Graeme showed you all you need to know to start working with PHP and the MySQL database.

I thought I'd take a few minutes to show what these tools can do once you put them to work. Using the code I have here, you can add a threaded discussion area to your site. It might look suspiciously familiar to some of you, but that's OK.

I'm using MySQL, but be aware that PHP supports nearly every database I've ever heard of and a few I haven't. So if you've got something else already installed, use that. The PHP functions are named similarly and do similar things — almost as if someone planned it that way. Be warned, though, that the database systems themselves aren't much alike. Sybase, Oracle, Postgres, MySQL, and mSQL are all good relational databases — they can all use SQL — but once you get away from the basic functions, they work a bit differently. This is a good thing. It's more likely that one of them will fit your needs. Just don't count on, say, outer joins working the same way from one to the other.

Having covered myself here, let's move on to the code.

next page»