Help! Trying to put images in rows
Posted: Sat Apr 18, 2009 10:17 pm
I want to put my images in rows of 4 can anyone help me with this?
Right now I have the images pulling up in one long column.
I have tried a few different ways to get them in a row
here is the very short version I have tried but could not get to work.
The above code with my code -
Can anyone help me put my images in a row of 4?
img1 img2 img3 img4
img5 img6 img6 img7
img8 img9 img10 img11
Right now I have the images pulling up in one long column.
Code: Select all
//pulls info for art work of the artist above
echo "<div id='title'>";
echo "<h1>Works <br><img src='image/smLine.jpg'></h1></div>";
$result2 = mysql_query("SELECT * FROM image WHERE artid LIKE '$search' ORDER BY title") or die(mysql_error());
$num_rows=mysql_num_rows($result2);
if ($num_rows != "0")
{
$count = count(0);
while ($r=mysql_fetch_array($result2))
{
$imgid=$r['imgid'];
$artid=$r['artid'];
$title=$r['title'];
$dtxt_1 =$r['dtxt_1'];
$dt=$r['dt'];
$medid=$r['medid'];
$size_inch=$r['size_inch'];
$size_cm=$r['size_cm'];
$musid=$r['musid'];
$movid=$r['movid'];
$genid=$r['genid'];
$perid=$r['perid'];
$bio=$r['bio'];
$keywords=$r['keywords'];
$notes=$r['notes'];
$verified=$r['verified'];
//display the row
echo "<div id='artContent'>";
echo "<span class='image'>";
echo $count++ ;
echo ". <div class=img-shadow><a href='image/$artid/$imgid.jpg' class='thickbox' title='$title by $fullName'>
<img src='image/thumb/$artid/$imgid.jpg' border=0 width=75 height='100' title='$title by $fullName' align=left valign=top></a></div></span>";
echo "<span class='info'>";
echo "<a href='image.php?imgid=$r[imgid]' title='$title by $fullName'>".$title."</a> <br>".$dt."<br>".$medid."<br>".$bio." ";
echo "</span></div>";
}
}I have tried a few different ways to get them in a row
here is the very short version I have tried but could not get to work.
Code: Select all
$i = 1;
while(...) {
//...
if ($i % 4) {
echo "<br />";
}
$i++;
}
Code: Select all
//pulls info for art work of the artist above
echo "<div id='title'>";
echo "<h1>Works <br><img src='image/smLine.jpg'></h1></div>";
$result2 = mysql_query("SELECT * FROM image WHERE artid LIKE '$search' ORDER BY title") or die(mysql_error());
$num_rows=mysql_num_rows($result2);
if ($num_rows != "0")
{
$count = count(0);
$i = 1;
while ($r=mysql_fetch_array($result2))
{
$imgid=$r['imgid'];
$artid=$r['artid'];
$title=$r['title'];
$dtxt_1 =$r['dtxt_1'];
$dt=$r['dt'];
$medid=$r['medid'];
$size_inch=$r['size_inch'];
$size_cm=$r['size_cm'];
$musid=$r['musid'];
$movid=$r['movid'];
$genid=$r['genid'];
$perid=$r['perid'];
$bio=$r['bio'];
$keywords=$r['keywords'];
$notes=$r['notes'];
$verified=$r['verified'];
//display the row
if ($i % 4) {
echo "<div id='artContent'>";
echo "<span class='image'>";
echo $count++ ;
echo ". <div class=img-shadow><a href='image/$artid/$imgid.jpg' class='thickbox' title='$title by $fullName'>
<img src='image/thumb/$artid/$imgid.jpg' border=0 width=75 height='100' title='$title by $fullName' align=left valign=top></a></div></span>";
echo "<span class='info'>";
echo "<a href='image.php?imgid=$r[imgid]' title='$title by $fullName'>".$title."</a> <br>".$dt."<br>".$medid."<br>".$bio." ";
echo "</span></div>";
}
$i++;
}
}
img1 img2 img3 img4
img5 img6 img6 img7
img8 img9 img10 img11