Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. Your original code:

     

    
    include "config.php"; 
    
    //$forumid = $_GET['id'];
    
    $forumid = "HARD CODE THIS";
    
    print "<link rel='stylesheet' href='style.css' type='text/css'>";
    
    print "<A href='post.php?id=$forumid'>New Topic</a><br>";
    
    print "
    <table class='maintable'>
    
    <tr class='headline'><td width=50%>Topic</td>
    <td width=20%>Author/td><td>Replies</td>
    <td>Last reply</td>
    </tr>
    ";
    
    $info="SELECT * from post_reply where parentid='0' AND forumid='$forumid' ORDER BY lastrepliedto DESC";
    
    $info2=mysql_query($info) or die(mysql_error());
    
    while($info3=mysql_fetch_array($info2))
    
    {
    
      $info3[title]=strip_tags($info3[title]);
    
      $info3[author]=strip_tags($info3[author]);
    
      print "
      <tr class='mainrow'><td><A href='message.php?id=$info3[postid]'>$info3[title]</a></td>
      <td>$info3[author]</td>
      <td>$info3[numreplies]</td>
      <td>$info3[showtime]<br>Last post by <b>$info3[lastposter]</b>
      </td>
      </tr>
      ";
    
    }
    
    print "</table>";
    
    

     

     

    If you are using "forumid" to identify then make it an "int" and "auto increment" and make it "key"

  2. <?php
    
    include "config.php"; 
    
    $TEST=mysql_query("SELECT post FROM post_reply");
    
    if (!$TEST){die(mysql_error());}
    
    $num_rows = mysql_num_rows($TEST);
    
    echo "I have $num_rows in the row forumid and here they are:<br /><br /><br />";
    
    WHILE($row=mysql_fetch_array($TEST)){
    
    $post=$row['post'];
    
    echo $post."<br />";
    
    
    
    }
    
    // CLOSE YOUR CONNECTION??
    
    ?>

  3. $forumid=$_POST['forumid']; // TAKE IT OUT

     

    Stupid mistake on my part put this on the test page:

     

    
    <?php
    
    include "config.php"; 
    
    $TEST=mysql_query("SELECT yourpost FROM post_reply");
    
    if (!$TEST){die(mysql_error());}
    
    $num_rows = mysql_num_rows($TEST);
    
    echo "I have $num_rows in the row forumid and here they are:<br /><br /><br />";
    
    WHILE($row=mysql_fetch_array($TEST)){
    
    $yourpost=$row['yourpost'];
    
    echo $yourpost."<br />";
    
    
    
    }
    
    // CLOSE YOUR CONNECTION??
    
    ?>
    
    

     

    Why is your forumid a text field?

    I imagine (since you can't get to phpAdmin) that $yourpost is a text field

  4. here is the right code

     

    $insertpost=mysql_query(" INSERT INTO post_reply(author,title,post,forumid,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$forumid','$displaytime','$thedate','$name') ");
    
    if (!$insertpost){die(mysql_error());}

  5. Now I know it's empty.

     

    You are inserting blank values int the row forumid...

     

    
    $forumid = $_GET['id']; // THIS MIGHT APPLY TO SOMETHING ELSE BUT NOT ON SUBMIT
    
    
    if(isset($_POST['submit']))
    
    {
       $forumid=$_POST['forumid']; // YOUR VAR WAS EMPTY
    
       $name=$_POST['name'];
    
       $yourpost=$_POST['yourpost'];
    
       $subject=$_POST['subject'];
    
    

     

    You have 4 empty rows.

  6. Then I am pretty sure forumid is empty.  The problem must be on post.

     

    On your post page...

     

    change:

    
    $insertpost="INSERT INTO post_reply(author,title,post,forumid,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$forumid','$displaytime','$thedate','$name')";
    
    mysql_query($insertpost) or die("Could not insert post"); 
    
    

     

    To:

    
    $insertpost=mysql_query("INSERT INTO post_reply(author,title,post,forumid,showtime,realtime,lastposter) values('$name','$subject','$yourpost','$forumid','$displaytime','$thedate','$name')";
    
    if (!$insertpost){die(mysql_error());}
    
    

     

     

     

    Try this.

  7. <?php
    
    include "config.php"; 
    
    $TEST=mysql_query("SELECT forumid FROM post_reply");
    
    if (!$TEST){die(mysql_error());}
    
    $num_rows = mysql_num_rows($TEST);
    
    echo "I have $num_rows in the row forumid and here they are:<br /><br /><br />";
    
    WHILE($row=mysql_fetch_array($TEST)){
    $forumid=$row['forumid'];
    
    if ($num_rows=="0"){
    
    echo"
    connecting to the wrong DB<br />
    AND / OR<br />
    connecting to the wrong table<br />
    AND / OR<br />
    forumid is empty<br />
    ";
    
    
    }else {$forumid."<br />";}
    
    
    
    }
    
    // CLOSE YOUR CONNECTION??
    
    ?>

  8. If that gave you a blank page:

     

    
    <?php
    
    include "config.php"; 
    
    $TEST=mysql_query("SELECT forumid FROM post_reply");
    
    if (!$TEST){die(mysql_error());}
    
    $num_rows = mysql_num_rows($TEST);
    
    echo "I have $num_rows in the row forumid";
    
    WHILE($row=mysql_fetch_array($TEST)){
    $forumid=$row['forumid'];
    
    if ($num_rows=="0"){
    
    echo"
    connecting to the wrong DB<br />
    AND / OR<br />
    connecting to the wrong table<br />
    AND / OR<br />
    forumid is empty<br />
    ";
    
    
    }else {$forumid."<br />";}
    
    
    
    }
    
    // CLOSE YOUR CONNECTION??
    
    ?>
    
    

     

     

    This will not give you a blank page.

     

  9. <?php
    
    include "config.php"; 
    
    $TEST=mysql_query("SELECT forumid FROM post_reply");
    
    WHILE($row=mysql_fetch_array($TEST)){
    $forumid=$row['forumid'];
    
    echo $forumid."<br />";
    
    }
    
    // CLOSE YOUR CONNECTION??
    
    ?>

     

    Try it without the WHERE clause.

  10. 
    <?php
    
    include "config.php"; 
    
    $TEST=mysql_query("SELECT forumid FROM post_reply WHERE parentid='0' ");
    
    WHILE($row=mysql_fetch_array($TEST)){
    $forumid=$row['forumid'];
    
    echo $forumid;
    
    }
    
    // CLOSE YOUR CONNECTION??
    
    ?>
    
    What does this give you?
    
    

  11. print "<tr class='mainrow'><td><A href='message.php?id=$info3[postid]'>$info3[title]</a></td><td>$info3[author</td
    <td>$info3[numreplies]</td><td>$info3[showtime]<br>Last post by <b>$info3[lastposter]</b></td></tr>";
    
    $info3[author</td // not closed "]" and the </td is not closed ">"
    
    should be: $info3[author]</td>
    
    
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.