Jump to content

EASIER WAY TO WRITE THIS SIMPLE CODE?


jigsawsoul

Recommended Posts

                    <?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.

Link to comment
https://forums.phpfreaks.com/topic/217312-easier-way-to-write-this-simple-code/
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.