Jump to content

display new row problem


abhikerl

Recommended Posts

Hi, I want to display a data so that it appears as follows:

 

<tr><td> 1</td>2</td></tr>

<tr><td> 3</td>4</td></tr>

<tr><td> 5</td>6</td></tr>

 

I want that after an amount of record being displayed, it automatically add the next record on different row. Can anyone help me, plz..am new to php and still learning..thanks.

Link to comment
https://forums.phpfreaks.com/topic/170983-display-new-row-problem/
Share on other sites

Hi,

 

One way you could try would be as follows:

 

// Database stuff here

$count = 0;

echo "<tr>";

while($row = mysql_fetch_array($query))

{

    if($count == 2)

    {

        echo "</tr><tr>";

        $count = 0;

    }

    echo "<td>" . $row['result'] . "</td>";

    $count++;

}

echo "</tr>";

 

Hope this helps

 

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.