Jump to content

[SOLVED] forum issue or maybe php issue ??


runnerjp

Recommended Posts

for some reason i cant seem to understand that if i have a thread and a reply my form displays like so

 

no1.jpg

 

 

but if i only have a thread it displays like this

 

no2.jpg

 

 

sorry if this is in wrong room but im thinkin its my php thats doing it...

 

<table class='maintable'>

<tr class='headline'><td width=20%>Author</td><td width=80%>Post</td></tr> <?php
if ($pagenum == 1){
?>
<tr class='mainrow'><td valign='top'><?php echo $gettopic3['author'] ?> </td>
<td vakign='top'>created on <?php echo $gettopic3['showtime']?><br>
  <hr>
  <p>
  <?php

$message = $gettopic3['post'];

$message=nl2br($message); ?>

  <? echo $message ?></p>
  <p><br>

    </p></td></tr>
<?php
}

$getreplies="Select * from forumtutorial_posts where parentid='$id' $max"; //getting replies

$getreplies2=mysql_query($getreplies) or die(mysql_error()."Could not get replies");

while($getreplies3=mysql_fetch_array($getreplies2))

{

   ?><tr class='mainrow'><td valign='top'><? echo $getreplies3['author']?> </td><td vakign='top'>replied  at <? echo $getreplies3['showtime']?> <br>
  <hr>
    <p>
      <?php

   $message=$getreplies3['post'];

   $message=nl2br($message);

   ?>
      <?php echo $message?></p>
    <p><br>

      </p></td></tr>

</table>

Link to comment
Share on other sites

sorry chnaged above images... can you soo the munu on the right changing position....

 

<table class='maintable'>

<tr class='headline'><td width=20%>Author</td><td width=80%>Post</td></tr> <?
if ($pagenum == 1){
?>
<tr class='mainrow'><td valign='top'><? echo $gettopic3['author'] ?> </td>
<td valign='top'>created on <? echo $gettopic3['showtime']?><br>
  <hr>
  <p>
  <?

$message = $gettopic3['post'];

$message=nl2br($message); ?>

  <? echo $message ?></p>
  <p><br>

    </p></td></tr>
<?php
}

$getreplies="Select * from forumtutorial_posts where parentid='$id' $max"; //getting replies

$getreplies2=mysql_query($getreplies) or die(mysql_error()."Could not get replies");

while($getreplies3=mysql_fetch_array($getreplies2))

{

   ?><tr class='mainrow'><td valign='top'><? echo $getreplies3['author']?> </td><td valign='top'>replied  at <? echo $getreplies3['showtime']?> <br>
  <hr>
    <p>
      <?

   $message=$getreplies3['post'];

   $message=nl2br($message);

   ?>
      <? echo $message?></p>
    <p><br>

      </p></td></tr>

</table>

 

thing is without php works fine with does that

Link to comment
Share on other sites

they tinkerings in the system... i havent asked any 1 to make me a forum at all...

 

4 questions i have asked of today are

 

1. this one... which is not building anything but solving

 

2. how to add my url in a php echo ... once again building nothing of my forum but giving me advice so i know how to use it

 

3. whats the best way to do the sliding menu.... you told me spry... and i went away looked it up and as you see from my images i have it working... so this one was for advice...

 

4. i had my script set up within the ajax menu but it was not working properly... they advised my so insert a hidden field as this would solve it.... once again i built it all and just needed guidence on my error...

 

so to answer you question i have a few as im still gttin the nack of this stuff... learn as you go kinda job... so yes they are here to help in which they are doing and im very greatfull for but they have not created any part of my forum at all!

 

Link to comment
Share on other sites

in your script when your looping for ur replies you used this...

 

<? echo $getreplies3['author']?>

 

Quickly check to make sure that thats right in the db.

I dont think that'll fix it tho. Its definately to do with the table (html and also layout).

Cant find the problem tho...

Link to comment
Share on other sites

yer they are all correct as then there are in the db they are shown... but surly it cant be a html and layout problem because when i have information for both threads and replies it does this

 

no2.jpg

 

this is the form thats goes wierd when there are no replies yet... as soon as i replie is made it goes correct

Link to comment
Share on other sites

this is just because its an include page thing... <? $page = $_GET['page'];

                    if (ereg('[A-Za-z0-9]',$page) ) {

                        if (file_exists('include/'.$page.'.php')) {

                            include('include/'.$page.'.php');

                        } else {

                            include('include/main.php');

                        }

                  } else {

                            include('include/main.php');

                    }?>

 

thats deff not issue

Link to comment
Share on other sites

ok iv done cuttin pasting ect lol an i have found the problem

 

<?php
}

$getreplies="Select * from forumtutorial_posts where parentid='$id' $max"; //getting replies

$getreplies2=mysql_query($getreplies) or die(mysql_error()."Could not get replies");

while($getreplies3=mysql_fetch_array($getreplies2))

{

   ?>

 

this php here (i new it was php)  but thing is why and what do i do

Link to comment
Share on other sites

ok also iv just found out that if i post more then 3 posts it goes mental lol

 

im going to post the whole script to see if my paginagtion has anything to do with it

 

<link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css">
<link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/members/include/style.css">
<?php

include "connect.php"; //mysql db connection here
$id=$_GET['id'];
$forum=$_GET['forum']; 
$pagenum = isset($_GET['pagenum']) ? $_GET['pagenum'] : "1";

$gettopic="SELECT * from forumtutorial_posts where postid='$id'";
$gettopic2=mysql_query($gettopic) or die("Could not get topic");
$gettopic3=mysql_fetch_array($gettopic2);
?>
<A href='index.php?page=mainforums'><img src="http://www.runningprofiles.com/images/homeforum.gif" alt="home" border="0"  /></a>
<A href="index.php?page=forum&forum=<?php echo $forum ;?>"><img src="http://www.runningprofiles.com/images/backforum.gif" alt="forum" border="0"  /></a> <A href="index.php?page=post"><img src="http://www.runningprofiles.com/images/new_post.gif" border="0"  /></a>  


<?php  if($gettopic3['forumlock'] == 0)
{
    echo "<a href=\"index.php?page=reply&id=$id\"><img src=\"http://www.runningprofiles.com/images/post_reply.gif\" border=\"0\"  /></a>";
}
else
{
    echo 'forum is locked';
}
?>




<?php

//Here we count the number of results
//Edit $data to be your query
$data = mysql_query("SELECT * from forumtutorial_posts where parentid='$id'") or die(mysql_error());
$rows = mysql_num_rows($data);

//This is the number of results displayed per page
$page_rows = 10;

//This sets the range to display in our query
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
//This is your query again, the same one... the only difference is we add $max into it
{
?>
<?php
}?>
<table class='maintable'>

<tr class='headline'><td width=20%>Author</td><td width=80%>Post</td></tr> <?php
if ($pagenum == 1){
?>
<tr class='mainrow'><td valign='top'><?php echo $gettopic3['author'] ?> </td>
<td valign='top'>created on <?php echo $gettopic3['showtime']?><br>
  <hr>
  <p>
  <?php

$message = $gettopic3['post'];

$message=nl2br($message); ?>

  <?php echo $message ?></p>
  <p><br>
    </p></td></tr>
<?php
}

$getreplies="Select * from forumtutorial_posts where parentid='$id' $max"; //getting replies

$getreplies2=mysql_query($getreplies) or die(mysql_error()."Could not get replies");

while($getreplies3=mysql_fetch_array($getreplies2))

{

   ?><tr class='mainrow'><td valign='top'><?php echo $getreplies3['author']?></td>
<td valign='top'>replied  at <?php echo $getreplies3['showtime']?> <br>
  <hr>
    <p>
      <?php

   $message=$getreplies3['post'];

   $message=nl2br($message);

   ?>
      <?php echo $message?></p>
    <p><br>
    </p></td></tr>
</table>

<?php
echo "<br>";
}
// Find out the total number of pages depending on the limit set
    $numofpages = $rows / $page_rows;
    $totalpages = ceil($numofpages);

// Start links for pages
$maxpage = $totalpages == 0 ? 1 : $totalpages; // add this line
echo "<p align=center>Page $pagenum of $maxpage <br /> "; // change this

// Sets link for previous 25 and return to page 1
    if($pagenum != 1){
        $pageprev = ($pagenum - 1);
         echo "<a href=\"".$_SERVER['PHP_SELF']."?page=message&id=$id&pagenum=1\"><<</a>  ";
         echo "<a href=\"".$_SERVER['PHP_SELF']."?page=message&id=$id&pagenum=$pageprev\">PREV </a> ";
    }else{
        echo "";
    }

// Loop thru all the pages and echo out the links
    for($i = 1; $i <= $numofpages; $i++){
        if($i == $pagenum){
            echo "[".$i."] ";
        }else{
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=message&id=$id&pagenum=$i\">$i</a> ";
        }
    }

// Check for straglers after the limit blocks
    if(($rows % $page_rows) != 0){
        if($i == $pagenum){
            echo "[".$i."] ";
        }else{
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=message&id=$id&pagenum=$i\">$i</a> ";
        }
    }
// Print out the Next 25 and Goto Last page links
    if(($rows - ($page_rows * $pagenum)) > 0){
        $pagenext = $pagenum++;
          echo "<a href=\"".$_SERVER['PHP_SELF']."?page=message&id=$id&pagenum=$pagenext\">NEXT </a>  ";
          echo "<a href=\"".$_SERVER['PHP_SELF']."?page=message&id=$id&pagenum=$totalpages\">>></a>  ";
    }else{
        echo("");
    }
echo "</p>";
?> 
e]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.