PHP Feedback Thread Help

Hello,
I have designed a web site for a friends haunted forest. He is wanting a comment/feedback thread where people can come and tell about their experience. The thread works great, but the problem I am having now is I need it to either scroll or only show 4-5 comments at a time then give you a next button to click to get to the next set of comments. Here is what all the code looks like. It is in 3 sections, the feedback display, the php code, and the newfeedback form where you would write your feedback. [code]

Surviver Tales a:link {color:#FFFF00;} /* unvisited link */ a:visited {color:#FFFF00;} /* visited link */ a:hover {color:#FFFF00;} /* mouse over link */ a:active {color:#FFFF00;} /* selected link *
bloodline
<?php include('adodb/adodb.inc.php'); $DB = NewADOConnection('mysql');

$server = ‘mysql.freehostingnoads.net’;
$user = ‘u197478342_story’;
$pwd = ‘rabbit88’;
$db =‘u197478342_hauntfor’;

$DB->Connect($server, $user, $pwd, $db);

$DB->SetFetchMode(ADODB_FETCH_NUM);

$rs = $DB->Execute(“SELECT * FROM survivorStories”);

while ($rs->EOF == FALSE){

for ($i=0; $i < sizeof($rs->fields); $i++)
{

             switch($i){

               case 0: 
                  $Name = $rs->fields[$i];                   
               break;
               case 1: 
                  $Date = $rs->fields[$i];
               break;
               case 2: 
                  $Story = $rs->fields[$i];
               break;

}
}
echo ‘

’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘’;
echo ‘
Name: ‘.$Name.’ Date: ‘.$Date.’
Story: ‘.$Story.’
’;
echo ‘
’;

$rs->MoveNext();
}
?>
Click To Tell Us Your Story

	 <div id="footer">
		   <p><a href="http://flashbangpro.com" target="_blank">Copyright &copy; 2011 FlashBang Productions</a></p>		
     </div>
	 </div>
	 </body>
[/code]

[php]<?php
include(‘adodb/adodb.inc.php’);
$DB = NewADOConnection(‘mysql’);

$server = ‘mysql.freehostingnoads.net’;
$user = ‘u197478342_story’;
$pwd = ‘rabbit88’;
$db =‘u197478342_hauntfor’;

$DB->Connect($server, $user, $pwd, $db);

$DB->SetFetchMode(ADODB_FETCH_NUM);

$Name = $_POST[‘name’];
$Date = $_POST[‘date’];
$Story = $_POST[‘story’];

mysql_query("INSERT INTO survivorStories
(Name, Date, Story) VALUES(’$Name’, ‘$Date’, ‘$Story’) ");

header (‘location: blog.php’);
exit();
?>
[/php]

[code]

Surviver Tales a:link {color:#FFFF00;} /* unvisited link */ a:visited {color:#FFFF00;} /* visited link */ a:hover {color:#FFFF00;} /* mouse over link */ a:active {color:#FFFF00;} /* selected link *
bloodline

Your Name:

Date: (ex. YYYY/MM/DD)

Story:

	 </div>
	 <div id="footer">
		   <p><a href="http://flashbangpro.com" target="_blank">Copyright &copy; 2011 FlashBang Productions</a></p>		
     </div>
	 </div>
	 </body>
[/code]

I am new to PHP and trying to teach myself as much as I can.
Thank You all in advance for your help.

What do you need help with exactly? We can’t exactly run the code you provided to find the problem.

The problem I am having is I need it to either scroll or only show 4-5 comments at a time then give you a next button to click to get to the next set of comments, I’m not sure what code I need to add so I can make this happen, Or where I need to add the code.

It’s known as “lazy loading images”. My below average post-count prevents me from posting a link to Google, but there’s a lot of tutorials/plug-ins published around. If you have any more specific issues I’ll be happy to help.

Thank You I will check it out. Yeah it wouldn’t let me post the link to the website so you could actually see the thread in action. Thank you.

Lazy loading images isn’t exactly going to fix my problem. I’m not loading any images it is text like this forum thread, I just want to show 4 or 5 at a time then give an option to go to the next page, Or have the comments in some sort of scrollable div.

You don’t need to lazy load images per-say. It can be any content. Better off looking for a stable plug-in for jQuery - or whichever framework you use.

Hi there,

What you are trying to achieve here is called pagnation. Google the term for examples as well as tutorials. Pagnation allows you to display a limited number of items per page and calculates the total amount of pages needed to display the entire content. The numbers you see in forums like this as well as news boards that allow you to go to more pages to view more content is pagnation.

Hope this helps.

Sponsor our Newsletter | Privacy Policy | Terms of Service