Let me say this…I'm a designer and not all that knowledgeable on php. That said, I'm trying to set up a portfolio page with a 4 column grid. The last column needs to have no margin on it, so I'd like to set up for every fourth item to include a "last" class added to the "projectBox" class. Any help setting this up?
I've spent a few hours looking around the net for answers, but haven't found anything that worked.
Thanks for any help!
Chad
Here's the code I've got to begin with:
<?
include("includes/dbinfo.inc.php");
mysql_connect(localhost,$db_username,$db_password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM portfolio";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$client=mysql_result($result,$i,"Client");
$type=mysql_result($result,$i,"Type");
$image=mysql_result($result,$i,"Image");
$link=mysql_result($result,$i,"Link");
?>
<a href="<? echo "$link"; ?>">
<div class="projectBox">
<img class="thumbImage" src="http://www.cross-a.com/portfolio/thumbs/<? echo "$image"; ?>.jpg" />
<p class="thumbText"><strong><? echo "$client"; ?></strong><br />
<? echo "$type"; ?></p>
<div class="clear"></div>
</div> <!-- End of projectBox -->
</a>
<?
++$i;
}
?>