Jump to content

PHP Mod Help


The14thGOD

Recommended Posts

Hey, basically I want to display 4 pictures from my database on one row, and then when 4 are displayed, I want to start a new role, heres the php code:

[code]<?
while($row = mysql_fetch_array($results)) {
++$x;
if($x % 4){
echo("</tr>\n");
echo("<tr>\n");
}
echo("<td><a href=\"art_piece.php?type=$type&id=$row[id]\"><img class=\"img_margin_gallery\" src=\"$row[link_thumb]\" width=\"$row[thumb_width]\" height=\"$row[thumb_height]\" border=\"0\" alt=\"$row[alt]\" /></a></td>\n");
}
?>[/code]

It displays the images but not in rows of 4, heres the source i get:

[code]<tr>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=1"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_dbz_gogeta.jpg" width="74" height="130" border="0" alt="gogeta drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=2"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_dbz_goku.jpg" width="95" height="130" border="0" alt="goku drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=3"><img class="img_margin_gallery" src="images/drawings/full_view/anime_dbz_group.jpg" width="101" height="130" border="0" alt="gohan trunks goku drawing" /></a></td>

<td><a href="art_piece.php?type=drawings&id=4"><img class="img_margin_gallery" src="images/drawings/full_view/anime_dbz_trunks_01.jpg" width="99" height="130" border="0" alt="trunks drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=5"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_dbz_trunks_02.jpg" width="98" height="130" border="0" alt="trunks drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=6"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_dbz_trunks_03.jpg" width="129" height="130" border="0" alt="trunks drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=7"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_gw_wing_zero.jpg" width="100" height="130" border="0" alt="wing zero drawing" /></a></td>
<td><a href="art_piece.php?type=drawings&id=8"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_hack_subaru.jpg" width="94" height="130" border="0" alt="subaru drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=9"><img class="img_margin_gallery" src="images/drawings/thumbnails/anime_noir_chloe.jpg" width="106" height="130" border="0" alt="chloe drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=10"><img class="img_margin_gallery" src="images/drawings/thumbnails/concept_ship_stage01.jpg" width="150" height="109" border="0" alt="dragon ship drawing" /></a></td>

</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=11"><img class="img_margin_gallery" src="images/drawings/thumbnails/concept_ship_stage02.jpg" width="79" height="130" border="0" alt="dragon ship drawing" /></a></td>
<td><a href="art_piece.php?type=drawings&id=12"><img class="img_margin_gallery" src="images/drawings/thumbnails/concept_weapons_set_01.jpg" width="150" height="113" border="0" alt="weapon drawings" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=13"><img class="img_margin_gallery" src="images/drawings/thumbnails/vg_cloud.jpg" width="98" height="130" border="0" alt="cloud drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=14"><img class="img_margin_gallery" src="images/drawings/thumbnails/vg_kenetic.jpg" width="80" height="130" border="0" alt="kenetic drawing" /></a></td>
</tr>
<tr>
<td><a href="art_piece.php?type=drawings&id=15"><img class="img_margin_gallery" src="images/drawings/thumbnails/vg_link.jpg" width="80" height="130" border="0" alt="link drawing" /></a></td>[/code]

Thanks for any and all help :)

Oh ya, the img class is just a margin of 9px.
Link to comment
https://forums.phpfreaks.com/topic/35306-php-mod-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.