jigsawsoul Posted October 30, 2010 Share Posted October 30, 2010 <?php $result = "SELECT * FROM portfolio"; $result = mysql_query ($result) or die (mysql_error()); $i=0; while($row = mysql_fetch_assoc($result)) { if($i==0) echo '<div class="portfolioPage">'; if($i==2) $divclass = 'portfolioProjectWrapper borderWhite'; else $divclass = 'portfolioProjectWrapper borderGray'; echo ' <div class="'.$divclass.'"> <a href="portfolioPage.html" class="image asyncImgLoad" title="img/'.$row['image290x290'].'"></a> <p class="imageDesc">'.$row['image290x290_phot'].'</p> <h3 class="title">'.$row['title'].'</h3> <p class="subtitle">'.$row['subtitle'].'</p> <p class="desc"> '.substr($row['description'], 0, 1200).' <a href="portfolioPage.html" class="commonLink">Read more</a> </p> </div> '; if($i==2) echo '</div>'; if(i==2) $i=0; else $i++; } ?> Please help me im backward at this been along time. Quote Link to comment Share on other sites More sharing options...
Yucky Posted October 30, 2010 Share Posted October 30, 2010 Rather than just tidying it up, I'd suggest trying to find a better solution that perhaps doesn't involve the $i counter. What are you trying to achieve (in more detail than I can glean from the code)? Quote Link to comment Share on other sites More sharing options...
jigsawsoul Posted October 31, 2010 Author Share Posted October 31, 2010 Yeah I understand but im new to php is there away you could subject or anyone could? Quote Link to comment Share on other sites More sharing options...
litebearer Posted October 31, 2010 Share Posted October 31, 2010 It helps if you clearly explain your objective, then we can help 'clean up' Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.