Posted By

alberomo on 10/04/11


Tagged

get php classroom LaVioleta dynamicTables


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

rhainek


Table populated dinamically using ADODB php library code


 / Published in: PHP
 

URL: http://phplens.com/adodb/

It uses a variable with a RecordSet from a ADOdb Library (Library must be downloaded). db_query PHP Functions can be used to have the REcordSet(http://snipplr.com/view/59379/dbquery-php-function-for-ddbb-queries-with-adodb-library/)

Then uses ADODB php library functions and properties for fill the tables with the data of the RecordSet.

  1. <table>
  2. <thead>
  3. <tr>
  4. <?php
  5. for($k=0; $k<= $RecordSet->FieldCount( ) -1 ; $k++){
  6. $field = $RecordSet->FetchField($k);
  7. echo "<th>". $field->name."</th>";
  8. }
  9. ?>
  10. </tr>
  11. </thead>
  12. <tbody>
  13. <?php
  14. while( !$RecordSet->EOF){
  15. echo"<tr>";
  16. for($k=0; $k<= $RecordSet->FieldCount( ) -1 ; $k++){
  17. echo "<td>".$RecordSet->fields[$k]."</td>";
  18. }
  19. echo"</tr>";
  20. $RecordSet->MoveNext();
  21. }
  22. ?>
  23. </tbody>
  24. </table>

Report this snippet  

You need to login to post a comment.