The main page of a forum
We also have reached the end, date of creation topika and date of last answer to him is more exact prior to the beginning of the main page of a forum on which the list topikov, quantity{amount} of answers, the author topika is shown.
Basically, anything new. The quantity{amount} of recordings on page also is limited 20.
print_header ();
?>
<h2 align=center> <font color = "0000ff"> Webboard. </font> </h2>
<p align=right> | <a href = " <? php echo $script?>
? action=add_new_top "> Post new topic </a> |
<a href = " <? php echo $script?>? action=register "> Registration </a> |
<a href = " <? php echo $script?>? action=remind_pass "> Forgot password? </a>
| <a href = " <? php echo $script?>? action=search "> Search </a> |
<p> <table cellspacing=0 cellpadding=5 border=1>
<tr bgcolor = "D5E6E1"> <td align=center width=300 height=50>
<font face = "arial" size=2 color = "0000ff"> Topic name </font> </td>
<td align=center width=120 height=50>
<font face = "arial" size=2 color = "0000ff"> Topic starter </font> </td>
<td align=center width=50 height=50>
<font face = "arial" size=2 color = "0000ff"> Replies </font> </td>
<td align=center width=120 height=50>
<font face = "arial" size=2 color = "0000ff"> Posted </font> </td>
<td align=center width=120 height=50>
<font face = "arial" size=2 color = "0000ff"> Last reply </font> </td>
<? php
connect ();
$lines=20;
$begin = $ page * $ lines;
if (empty ($page)) {
$page=0;
}
$query = " select top_name, name, replies, post_date, last_reply from
topics order by last_reply desc limit $begin, $lines ";
$result=mysql_query ($query);
while ($row=mysql_fetch_array ($result)) {
$name = $ row ["name"];
$top_name = $ row ["top_name"];
$replies = $ row ["replies"];
$post_date = $ row ["post_date"];
$last_reply = $ row ["last_reply"];
?>
<tr bgcolor ='e6f8fa '> <td> <a href = " <? php echo $script?>
? action=read_topic*top_name =
<? php echo $top_name?> *name = <? php echo $name?> ">
<? php echo $top_name?> </a>
<? php echo " </td> <td> ". $name. " </td> <td align=center> ". $replies. " </td>
<td> ". $post_date. " </td> <td> ". $last_reply. " </td> </tr> ";
}
echo "</table>";
$query = " select COUNT (*) as count from topics ";
$result=mysql_query ($query);
$items=mysql_fetch_array ($result);
$count = $ items ["count"];
$pages=ceil (" $count / $ lines ");
if ($count> $lines) {
echo " <p align=right> ";
for ($i=0; $i <$pages; $i ++) {
?>
| <a href = " <? php echo $script?>? page = <? php echo $i?> ">
<? php echo ($i+1)?> </a> <? php
}
}
}
?>
Certainly, the given forum not an example for imitation. At everyone the manner of programming. Another it can will write in own way. However for a basis to accept it is possible.

|