Jump to content

two result in two horizontal columns without table


whynot

Recommended Posts

<?php
$i = 0; //set variable I as 0
echo '<div style="float:left;">'; //start a division.
while($row = mysql_fetch_assoc($result)) { //fetch the data.
if(++$i == 5) { //if $i has passed 4 which means 4 lines have been printed, close the division and open another.
       echo '</div><div>';
}
echo implode(',<br />',$row); //echo the data.
}
echo '</div>'; //close the final division.

I wirte this code for 4 * 4 :

echo "<div><ul>";
$c = 1;
$media = mysql_query("SELECT * FROM " . "$prefix" . "screen where id=\"$id\" order by id desc limit 16");
while ($cms = mysql_fetch_assoc($media)) {

  if (!($c%4)) echo ($c!=0 ? "</ul>" : "")."<ul>";

    echo "<li><a href=\"#\"><img src=\"#\"></a></li>\n";

    $c++;
        }

    echo "</ul></div>\n";

  for ($cnt=$c;$cnt%4>0;$cnt++);
?>

 

Html output is :

 

<UL>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
</UL>
<UL>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
</UL>
<UL>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
</UL>
<UL>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
    <li><a href=\"#\"><img src=\"#\"></a></li>
</UL>
<UL>
    <li><a href=\"#\"><img src=\"#\"></a></li>
</UL>

 

This is false . actually i need to each <UL> 4 <LI> . What's problem !

 

Thanks.

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.