Jump to content

Showing 5 results....


last_trace

Recommended Posts

[url=http://www.php-mysql-tutorial.com/examples/source/paging/paging3.phps]http://www.php-mysql-tutorial.com/examples/source/paging/paging3.phps[/url]

You can look there at a sample script...

and here for the tutorial...

[url=http://www.php-mysql-tutorial.com/php-mysql-paging.php]http://www.php-mysql-tutorial.com/php-mysql-paging.php[/url]
Link to comment
https://forums.phpfreaks.com/topic/31534-showing-5-results/#findComment-146110
Share on other sites

oh ... i see.
Here is what I came up with.
[code]<?php
//Connect to the Database
$i = 1;
$sql = mysql_query ("SELECT column_name FROM `table_name`");
while($row = mysql_fetch_assoc($sql)){
echo $row['column'] . " | ";
if($i == 5){
echo "<BR>";
$i = 0;
}
$i = $i + 1;
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/31534-showing-5-results/#findComment-146117
Share on other sites

Something like this could work:
[CODE]<?php
$number_rows = 1000;    #You may need to change this. Chance to your liking.
$number_columns = 5;    #same with this. Chance to your liking.
for($r=1;$r<$number_rows;$r++){
    echo'<tr>';
    for($c=1;$c<$number_columns;c++){
          $row = mysql_fetch_array($row);
          if(!$row){
              break;
          }
          echo'<td>'.$row['field_name'].'</td>';
    }
    echo'</tr>';
}
?>[/CODE]
Link to comment
https://forums.phpfreaks.com/topic/31534-showing-5-results/#findComment-146120
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.