Nieuw lid |
|
Hier is de code
<?
session_start();
include "config.php";
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$max_results = 10;
$from = (($page * $max_results) - $max_results);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body><?
$sql = "SELECT * FROM submenu LIMIT $from, $max_results";
$result = mysql_query($sql) or die (mysql_error());
while($record = mysql_fetch_object($result))
{
?>
<table align="center" width="500">
<tr>
<td width="300"><table align="center">
<tr>
</tr>
<tr>
<td valign="top"><a href="<? echo $record->submenu?>"><? echo $record->submenu?></a></td>
</tr>
</table> </td>
</tr>
</table>
<?
}
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM submenu"),0)or die (mysql_error());
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
?>
</body>
</html>
<? include "config.php"; if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $max_results = 10; $from = (($page * $max_results) - $max_results); ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body><? $sql = "SELECT * FROM submenu LIMIT $from, $max_results"; { ?> <table align="center" width="500"> <tr> <td width="300"><table align="center"> <tr> </tr> <tr> <td valign="top"><a href=" <? echo $record->submenu? >"> <? echo $record->submenu? ></a></td> </tr> </table> </td> </tr> </table> <? } // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); ?> </body> </html>
dit is de database tabel
CREATE TABLE `submenu` (
`id` int(11) NOT NULL auto_increment,
`submenu` text NOT NULL,
`link` text NOT NULL,
`submenu_02` text NOT NULL,
`link_02` text NOT NULL,
`submenu_03` text NOT NULL,
`link_03` text NOT NULL,
`submenu_04` text NOT NULL,
`link_04` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=30 ;
CREATE TABLE `submenu` ( `id` int(11) NOT NULL auto_increment, `submenu` text NOT NULL, `submenu_02` text NOT NULL, `link_02` text NOT NULL, `submenu_03` text NOT NULL, `link_03` text NOT NULL, `submenu_04` text NOT NULL, `link_04` text NOT NULL, ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=30 ;
|