On Thu, Jul 11, 2002 at 03:14:07PM +0200, [EMAIL PROTECTED] wrote:
> Another way of doing it is to use mysql_data_seek() to jump back and forth
> in the result set.

Now that Jason clarified what he's trying to do, Joakim is on target.  
Since this data set already exists, I'd do this rather than create another
data set in an array.  Trick is, how...

$Columns = 5;
$Rows = ceil( mysql_row_count($Result) / $Columns );

echo "<table border=\"1\">\n";
for ($RowCounter = 0; $RowCounter < $Rows; $RowCounter++) {
   echo " <tr>\n";
   for ($ColCounter = 0; $ColCounter < $Columns; $ColCounter++) {
      $Index = ($Rows * $ColCounter) + $RowCounter;
      echo '  <td>';
      if ( mysql_fetch_seek($Result, $Index) ) {
         $row = mysql_fetch_row($Result);
         echo $row[0];
      } else {
         echo '&nbsp;';
   echo " </tr>\n";
echo "</table>\n\n";

This stuff is untested on MySQL, but I tested it with a sample array and
it works.


               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to