Table populated dinamically using ADODB php library code


/ Published in: PHP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.