Translate

Wednesday 24 September 2014

PHP % Function for displaying image or paragraph in Div to fix as same height

Explaination:

By using this % PHP Function while displaying image or paragraph in dynamically the div height is in different
so we will use the PHP % function to make that has correctly.

Coding:

<?php
$select=mysql_query("select * from tbl ");
$c = 1;-->Intiliaze for % as 1
while($select_hotel12=mysql_fetch_array($select12))
{
.....
.....
?>
<?php 
if($c%3 == 0) {
echo '<div class="clear"></div>';
}
$c++;

} ?>

Note:

     1. In CSS we have to call the calss like .clear{clear:both;}
     
     2. if($c%3 == 0)-->it will dispaly only three columns in the page
       after getting three rows automatically it will form a new line
 
3. $c++-It will incerment the rows

No comments:

Post a Comment