I'm trying to make a "Pattern" display script where there are icon-sized preview (100x100). Currently I cannot get each image to show up on the same line, it ends up like this:
IMG 1
IMG 2
IMG 3
IMG 4
IMG 5
When I try using a table, i'm able to get it on one line but dont know how to control how many are on one line, so instead it ends up:
IMG1 IMG2 IMG3 IMG4 IMG5
and it only goes on , on one row there is no second row.
When I only want 4 images to be displayed per row.
How can I fix this so it ends up like this? :
IMG1 IMG2 IMG3 IMG4
IMG5 IMG6 IMG7 IMG8
IMG9 IMG10
and so forth?
code i'm using:
<div class="containerset"><table><tr><?php
// Connection
$hostname='localhost'; //EDIT usually 'localhost'
$user='bearhugs_user'; //EDIT username for database (replace db_admin)
$pass='******'; //EDIT password for database (replace starlight)
$dbase='bearhugs_stuff'; //EDIT databasename, not table name (replace db_layouts)
$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
//EDIT BELOW 'designs' to name of your table
$cat = strip_tags(mysql_escape_string($_GET['ca…
if($cat != "") {
$q="SELECT * from patterns where type = '$cat' order by id desc ";
} else {
$q="SELECT * from patterns order by id desc ";
} // layouts will be ordered by id descending
$result= mysql_query($q, $connection) or die
("Could not execute query : $q." . mysql_error());
//this part controls your dynamic navigation (automatic pages)
// EDIT LINE BELOW - change #(5) of layouts you want to show per page
$rows_per_page=5;
$total_records=mysql_num_rows($result)…
$pages = ceil($total_records / $rows_per_page);
$screen = $_GET["screen"];
if (!isset($screen))
$screen=0;
$start = $screen * $rows_per_page;
$q .= "LIMIT $start, $rows_per_page";
$result= mysql_query($q, $connection) or die
("Could not execute query : $q." . mysql_error());
//Display data from table
while ($row=mysql_fetch_array($result))
{
$id=$row["id"];
$date=$row["date"];
$title=$row["title"];
$thumb=$row["thumb"];
$preview=$row["preview"];
$download=$row["download"];
$pcounter=$row["pcounter"];
$dcounter=$row["dcounter"];
?>
<div class="left"><td>
" title="(<?php echo "$dcounter"; ?>)"><img src="http://s1106.photobucket.com/albums… echo "$id"; ?>preview.png">
</td>
</div>
<?php
} #end of while
?>