I am trying to make my sister a MessageBoard type webpage and i have a MASSIVE problem. Her friends are leaving LOADS of messages and my page is filling up. meaning soon long loading times 🙁
Is it possible to make it so the page checks how many entries are in my database and then only displays say 20 and then gives a next/previous link to the next group of messages? depending on how many messages there are?
I just cant get my head around it (as i am new to PHP and MYSQL)
this is the code i am currently running. (know its not good but for now working)
Any help will be BRILLIANT.
Thanks
Richard
😕
<?php include "header.dat" ?> //include the heading and links
<br>
<h3>
<a href = "signmesageboard.php">Leave Message</a><br>
</h3>
<?
MySQL_connect("$hostlink","$login","$secretcodes"); //connect to MYSQL
//Select the database we want to use
MySQL_select_db("messageboard") or die("Could not select database");
//Selects all data from table
$query = "SELECT * FROM messages order By ID DESC";
$result = MySQL_query($query);
//Loop to print each line of database
While( $rows = MySQL_fetch_array($result) ) {
$name = $rows['name'];
$email = $rows['email'];
$comments = $rows['comments'];
?>
<center><table border = 2 width = 60%><tr><td bgcolor="00CCFF"><?echo("<h3>$name</td></tr><Tr><td><h4>$email</td></tr><tr><td>$comments</td></tr></table>");//line that makes the layout!
//clears variables
$name=="";
$email=="";
$comments=="";
}
//Close the connection to MySQL
MySQL_close();
?>