hi all. The following code is implementing a paging system where 20 records in a page is displayed.Right now the code displays all the records (images) below each other.
What i want is to display 5 image/record in a row instead of 1 to avoid excess scrolling. I Be happy if some one show me how this can be done.Thanks
PHP Code:<html>
<head>
<title>Implementing Paging with next and prev</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// how many rows to show per page
$rowsPerPage = 20;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$server = "localhost"; // MySQL hostname
$username = "root"; // MySQL username
$password = ""; // MySQL password
$dbname = "test"; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$query = "SELECT idyoutube,thumbnail_url,title,view_count,comment_count FROM videos2 LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
// print the random numbers
while($row = @mysql_fetch_array($result)) {
?>
<table class="fr_thumb" bgcolor="#FFFFFF"><tr><td style="padding:0"><a href="./player.php?videoid=<?php echo $row["idyoutube"] ?>"><img width="120" class="frontPageRecentThumb" height="90" border="0" src="<?php echo $row["thumbnail_url"] ?>"></a></td></tr></table><br />
<TR><TD vAlign=top align="center">
<DIV style="FONT-WEIGHT: bold; FONT-SIZE: 12px"><a href="./player.php?videoid=<?php echo $row["idyoutube"] ?>"><?php echo $row["title"] ?></a></DIV>
<DIV style="FONT-SIZE: 11px; COLOR: #666666; PADDING-TOP: 2px; FONT-FAMILY: Arial, Helvetica, sans-serif">
Views: <?php echo $row["view_count"] ?> | <?php echo $row["comment_count"] ?>: 0 </DIV><br />
<hr>
<?
}
echo '<br>';
?>




Reply With Quote