RE: [PHP-DB] RE: [PHP] Printing MySQL into HTML Tables

2001-03-23 Thread Michael Rudel

Or try this one, its simple but more universal and very usefull for eg. testing.
... and a bit mor structured 8)=)

?php
  function result_all( $sql_result )
  {
 echo "TABLE\n";

 $columns = mysql_num_fields( $sql_result );

 for ( $i = 0; $i  $columns; $i++ )
 {
echo "   TH ".mysql_field_name( $sql_result, $i )." /TH\n";
 }

 while ( $row = mysql_fetch_row( $sql_result ) )
 {
echo "   TR\n";

for ( $count = 0; $count  $columns; ++$count )


   echo "  TD ".$row[$count]." /TD\n";
}

echo "   /TR\n";
 }

 echo "/TABLE\n";
  }
?

Greetinx,
  Mike

Michael Rudel
- Web-Development, Systemadministration -
___

Suchtreffer AG
Bleicherstrae 20
D-78467 Konstanz
Germany
fon: +49-(0)7531-89207-17
fax: +49-(0)7531-89207-13
e-mail: mailto:[EMAIL PROTECTED]
internet: http://www.suchtreffer.de
___



 -Original Message-
 From: Bart A. Verbeek [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, March 22, 2001 11:37 PM
 To: PHP-DB mailinglist; [EMAIL PROTECTED]
 Subject: [PHP-DB] RE: [PHP] Printing MySQL into HTML Tables


 Hello,
 Using it myself to...
 Maybe this will help you out:

 !--BEGIN TABLE BORDER--
 table width='90%' align='left' border='1'trtd
 !--BEGIN TABLE DATA--
 table width='90%' align='left'
 trtd colspan='2'align='left'
 font color='#FF' face='Verdana' size='2'bblabla a
 headline here
 /b/font/td/tr
 tr !-- first tr for table with data --
 ?php
 require ('dbconnect_includefile_with_passwd.inc');
 $i=1; //this sets the counter to 1
 $naam_nl = "%";
 $result = mysql_query ("your query goes here to retrieve the data");
 if ($row = mysql_fetch_array($result)) {
 do {
echo  "td width='50%'" . $row["1"] . "/td";
$i++; //the counter loops trough the do()while() and prints records
 if ($i==3)
 {
 echo "/trtr"; //when the counter reaches 3 it prints
 the row-end and
 new beginning.
   //don't forget to code the tr for the
 first row
 outside of the php-code
 $i=1; //sets the counter to one again and the loop starts all over
 }
   } while ($row = mysql_fetch_array($result));
   } else {print ("Sorry, no record were found.");}

 ?
 /tr/table
 !--END TABLE DATA--
 /td/tr/table
 !--END TABLE BORDER--

 Hope thsi will help.

 Regards,
 Bart

 -Oorspronkelijk bericht-
 Van: Jeff Oien [mailto:[EMAIL PROTECTED]]
 Verzonden: donderdag 22 maart 2001 22:19
 Aan: PHP
 Onderwerp: [PHP] Printing MySQL into HTML Tables


 I would like to do this with a MySQL database containing
 product information:

 trtdProduct 1 Info/tdtdProduct 2 Info/td/tr
 trtdProduct 3 Info/tdtdnbsp;/td/tr

 And if there are an odd number of products I want it to
 complete the table row with nothing in the cell. I want
 it to be able to automatically do this no matter how many
 products there are. I'm not sure how to set it up to
 print every other like that.
 Jeff Oien

 --
 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]




 --
 PHP Database 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]



-- 
PHP Database 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]




Re: [PHP-DB] RE: [PHP] Printing MySQL into HTML Tables

2001-03-23 Thread JJeffman

Congratulations !! Very good solution ! Simple and efficient !

Cheers,

Jayme.

-Mensagem Original-
De: Michael Rudel [EMAIL PROTECTED]
Para: [EMAIL PROTECTED]; 'PHP-DB mailinglist' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Enviada em: sexta-feira, 23 de maro de 2001 08:29
Assunto: RE: [PHP-DB] RE: [PHP] Printing MySQL into HTML Tables


 Or try this one, its simple but more universal and very usefull for eg.
testing.
 ... and a bit mor structured 8)=)

 ?php
   function result_all( $sql_result )
   {
  echo "TABLE\n";

  $columns = mysql_num_fields( $sql_result );

  for ( $i = 0; $i  $columns; $i++ )
  {
 echo "   TH ".mysql_field_name( $sql_result, $i )."
/TH\n";
  }

  while ( $row = mysql_fetch_row( $sql_result ) )
  {
 echo "   TR\n";

 for ( $count = 0; $count  $columns; ++$count )


echo "  TD ".$row[$count]." /TD\n";
 }

 echo "   /TR\n";
  }

  echo "/TABLE\n";
   }
 ?

 Greetinx,
   Mike

 Michael Rudel
 - Web-Development, Systemadministration -
 ___

 Suchtreffer AG
 Bleicherstrae 20
 D-78467 Konstanz
 Germany
 fon: +49-(0)7531-89207-17
 fax: +49-(0)7531-89207-13
 e-mail: mailto:[EMAIL PROTECTED]
 internet: http://www.suchtreffer.de



-- 
PHP Database 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]




[PHP-DB] RE: [PHP] Printing MySQL into HTML Tables

2001-03-22 Thread Bart A. Verbeek

Hello,
Using it myself to...
Maybe this will help you out:

!--BEGIN TABLE BORDER--
table width='90%' align='left' border='1'trtd
!--BEGIN TABLE DATA--
table width='90%' align='left'
trtd colspan='2'align='left'
font color='#FF' face='Verdana' size='2'bblabla a headline here
/b/font/td/tr
tr !-- first tr for table with data --
?php
require ('dbconnect_includefile_with_passwd.inc');
$i=1; //this sets the counter to 1
$naam_nl = "%";
$result = mysql_query ("your query goes here to retrieve the data");
if ($row = mysql_fetch_array($result)) {
do {
   echo  "td width='50%'" . $row["1"] . "/td";
   $i++; //the counter loops trough the do()while() and prints records
if ($i==3)
{
echo "/trtr"; //when the counter reaches 3 it prints the row-end and
new beginning.
  //don't forget to code the tr for the first row
outside of the php-code
$i=1; //sets the counter to one again and the loop starts all over
}
  } while ($row = mysql_fetch_array($result));
  } else {print ("Sorry, no record were found.");}

?
/tr/table
!--END TABLE DATA--
/td/tr/table
!--END TABLE BORDER--

Hope thsi will help.

Regards,
Bart

-Oorspronkelijk bericht-
Van: Jeff Oien [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 22 maart 2001 22:19
Aan: PHP
Onderwerp: [PHP] Printing MySQL into HTML Tables


I would like to do this with a MySQL database containing
product information:

trtdProduct 1 Info/tdtdProduct 2 Info/td/tr
trtdProduct 3 Info/tdtdnbsp;/td/tr

And if there are an odd number of products I want it to
complete the table row with nothing in the cell. I want
it to be able to automatically do this no matter how many
products there are. I'm not sure how to set it up to
print every other like that.
Jeff Oien

--
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]




-- 
PHP Database 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]