I have put mysql content in cells fine before just this time I need it so there are 3 cells in each row and info in each cell. There is also some pagination info in here so that it splits it up 12 chunks of info per page.
<?
require ('dbconnect.php');
$Limit = 12;
$page=$_GET["page"]; //Get the page number to show
If($page == "") $page=1; //If no page number is set, the default page is 1
//Get the number of results
$tquery = "SELECT * FROM portfolio imageid DESC";
$tmyresult = mysql_query($tquery) or die(mysql_error());
$NumberOfResults = mysql_num_rows($tmyresult);
//Get the number of pages
$NumberOfPages=ceil($NumberOfResults/$Limit);
$query = "SELECT * FROM portfolio imageid DESC LIMIT " . ($page-1)*$Limit . ",$Limit";
$myresult = mysql_query($query) or die(mysql_error());
$Nav="";
If($page > 1) {
$Nav .= "<A HREF=\"portfolio.php?page=" . ($page-1) . "\"><<Prev</A>";
}
For($i = 1 ; $i <= $NumberOfPages ; $i++) {
If($i == $page) {
$Nav .= " <B>$i</B> ";
}Else{
$Nav .= " <A HREF=\"portfolio.php?page=" . $i . "\">$i</A> ";
}
}
If($page < $NumberOfPages) {
$Nav .= "<A HREF=\"portfolio.php?page=" . ($page+1) . "\">Next>></A>";
}
echo "<table>\n";
$columns = 3;
$col_rows = intval($NumberOfResults / $columns);
$count = 1;
$max = $page * $Limit;
$firstone = $page - 1;
$firsttwo = $firstone * $Limit;
$first = $firsttwo +1;
if($page == $NumberOfPages){Echo '<tr><td colspan=3 bgcolor=#404040><p class=size>Showing '.$first.' thru '. $NumberOfResults.' out of '.$NumberOfResults.', Images.</p> '.$nav.'</td></tr>';}else{ Echo '<tr><td colspan=3 bgcolor=#404040><p class=size>Showing '.$first.' thru '.$max.' out of '.$NumberOfResults.', Images.</p> '.$nav.'</td></tr>';}
while($row = mysql_fetch_array($myresult)) {
$row['client'] = stripslashes($row['client']);
$row['type'] = stripslashes($row['type']);
$row['location'] = stripslashes($row['location']);
$count = $count++;
if($count == $col_rows){
echo '<tr>';
echo '<td class=border onMouseOver="this.bgColor = \'#383838\'" onMouseOut ="this.bgColor = \'#000000\'" bgcolor="#000000" width=180><img src="./images/'.$row['location'].'thumb.jpg"><p class=padding><span class=h2>Client: </span>'.$row['client'].'</br><span class=h2>Type: </span>'.$row['type'].'</p></td>';
} else {
echo '<td class=border onMouseOver="this.bgColor = \'#383838\'" onMouseOut ="this.bgColor = \'#000000\'" bgcolor="#000000" width=180><img src="./images/'.$row['location'].'thumb.jpg"><p class=padding><span class=h2>Client: </span>'.$row['client'].'</br><span class=h2>Type: </span>'.$row['type'].'</p></td>';
}
Echo '<tr><td colspan=3 bgcolor=#404040>'.$nav.'</td></tr>';
echo "</table>";
?>