Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2008
    Posts
    94
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Internet Explorer Viewing ALL threads.

    Hey, I want it to view all threads from whatever the board ID is but it doesn't work.

    viewthreads.php
    PHP Code:
    <?php require_once("config.php"); 
    $id $_GET['id'];
    $name $_GET['name']; 
    $result mysql_query("SELECT * FROM threads WHERE `id`='$id'") or die(mysql_error());
     
    echo 
    " <table border='1' 'width = 30%' > ";

    // keeps getting the next row until there are no more to get
    while($row mysql_fetch_array$result )) { 
        
    // Print out the contents of each row into a table
        
    echo "<hr>";
        echo 
    $row['thread'] . '<a href="/forum/viewthread.php?id=' $row['id'] . '">Go</a>';
        echo 
    "<hr>"
        }
        
    ?>
    addthread.php
    PHP Code:
    <?php include("config.php");
    $id =$_POST['id'];
    $username $_POST['username'];
    $message =$_POST['message'];

    mysql_query("INSERT INTO threads 
    (id,username,message) VALUES('$id','$username','$message' ) "

    or die(
    mysql_error());  ?>

    new thread.php

    PHP Code:
    <?php include("config.php");
    $id $_GET['id']; ?><table width="897" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="261" height="29" valign="top"><form name="form1" method="post" action="addthread.php">
          <label>
            <input type="text" name="name" id="message">
            </label>
        </form>    </td>
        <td width="636">&nbsp;</td>
      </tr>
      <tr>
        <td height="185">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      
      
    </table>

    I don't know what's wrong.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    mysql_query("INSERT INTO threads
    (id,username,message) VALUES('$id','$username','$message' ) ")
    The above query shows that your table threads has fields named id,username,message.

    But here,
    echo $row['thread'] . '<a href="/forum/viewthread.php?id=' . $row['id'] . '">Go</a>';
    you are trying to print a value of field named thread

    Hope this helps!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    May 2008
    Posts
    94
    Thanks
    11
    Thanked 0 Times in 0 Posts
    I don't really see what you mean.

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Try
    Code:
    while($row = mysql_fetch_array( $result )) { 
        // Print out the contents of each row into a table
        echo "<hr>";
        echo $row['message'] . '<a href="/forum/viewthread.php?id=' . $row['id'] . '">Go</a>';
        echo "<hr>"; 
        }
    instead.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    New Coder
    Join Date
    May 2008
    Posts
    94
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Ok but now, I'ts not selecting boards now so that means it cannot get the board ID and every thread you make will be seperated.

    And I'm not getting "message" I'm getting the thread titlte which would be "thread".

    See what I'm trying to do is..

    When you click a board it views all threads in that same category. WHat I have now is you have to type ?id=8 and it'll go to that thread, It will not put them in the board.
    Last edited by NightFlyer; 05-17-2008 at 05:40 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •