PHPBuilder - Installing PHP under IIS and creating a Discussion Page 6



RSS Twitter
Articles Setup And Installation

Installing PHP under IIS and creating a Discussion - Page 6

by: Jayesh Jain
|
October 30, 2002

Creating PHP Files

We will have to create two PHP files (forum.php & node.php) to make our discussion forum work.
Please open any text editor and create the two files with the source code below (the code is well documented to tell you what each line does), save this file in C:\INETPUB\WWWROOT folder
Here is the code for first PHP file (forum.php)

<?php
  
// This is the DSN we have create for our database
  
$connect odbc_connect("forum""root""");
?>
<html>
<body>
Discussion Forum using PHP/Access under IIS<br /><br />
<a href="node.php?node=0">Post New Message</a>
<?php
   
     shownode
(0); // display all the main threads

   // This function is a recursive function which shall display all the br /anches 
   // and sub br /anches of the threads
   
function shownode($nodecode)
   {
          global 
$connect;   // using the global variable for connection
        // Get a list of all the sub nodes which specific parentcode
        
$noderesult odbc_exec($connect,"select * from forum where parentcode = $nodecode");
        echo  
'<ul type="disc">';
        while(
odbc_fetch_row($noderesult)) // get all the rows 
        
{
           
$code  odbc_result($noderesult,"code");
           
$title  odbc_result($noderesult,"title");
           
$uname  odbc_result($noderesult,"uname");
           
$email  odbc_result($noderesult,"email");
           echo  
"<li>";
           echo 
"<a href=\"node.php?node=$code\"> $title </a>";
           echo 
"-- by ($uname) $email<br />";
           
shownode($code);
        }
        echo  
"</ul>";
    }
?>
</body>
</html>

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
|
7
|
8
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Jayesh Jain

Comment:



Comment:

(Maximum characters: 1200). You have characters left.