Lindsay Adams <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
| This is exactly what I sent you.
| You have to realize that you can't print down one column, and then
start a
| new one.
| You have to print across, left to right before you go down.
| You have to modify the print statement to put it into a table, but
that is
| easy:
|

I have been playing about with this problem and I have come up with
the following code. I know it is not right, because it isn't working
:) but I think it is nearly what I want to do. I only want to have 3
cells in the table, with a third of the data in each.

Cheers for your help, Donald

<? $db = mysql_connect("localhost", "user","pass");
 mysql_select_db("database",$db);

 $query = "SELECT * FROM TYPES";
 $result = mysql_query($query);
 $num_rows = mysql_num_rows($result);

 if ($result){
     $i=0;
  echo "<table border=1>\n<tr>\n<td width='30%'>";
  $r = mysql_fetch_array($result);
  $type_name = $r["type_name"];

  while ( $i < ($num_rows/3) ){
     echo "$type_name[$i] <br>\n"; $i++;
  }
  echo "</td><td width='30%'>\n";
  while ($i <= (2*$num_rows/3) ){
     echo "$type_name[$i] <br>\n"; $i++;
  }
  echo "</td><td width='30%'>\n";
  while ($i <= $num_rows ){
     echo "$type_name[$i] <br>\n"; $i++;
  }
  echo "</tr></table>\n";

 } else {
 echo " sorry no data found ";
 }
?>


--
Cheers,  Donald  :)
__________________________________________
As well as learning more,
I learn that there is even more I don't know

http://www.donaldrnoble.f2s.com
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to