ADOdb Library for PHP Manual
Prev rs2html Next

rs2html($adorecordset,[$tableheader_attributes], [$col_titles])

This is a standalone function (rs2html = recordset to html) that is similar to PHP's odbc_result_all function, it prints a ADORecordSet, $adorecordset as a HTML table. $tableheader_attributes allow you to control the table cellpadding, cellspacing and border attributes. Lastly you can replace the database column names with your own column titles with the array $col_titles. This is designed more as a quick debugging mechanism, not a production table recordset viewer.

You will need to include the file tohtml.inc.php.

Example of rs2html:

<?php
    
include('tohtml.inc.php'); # load code common to ADOdb
    
include('adodb.inc.php'); # load code common to ADOdb
    
$conn = &ADONewConnection('mysql');   # create a connection
    
$conn->PConnect('localhost','userid','','agora');# connect to MySQL, agora db
    
$sql = 'select CustomerName, CustomerID from customers';
    
$rs   = $conn->Execute($sql);
    
rs2html($rs,'border=2 cellpadding=3',array('Customer Name','Customer ID'));
?>
 


Prev Home Next
Fields Up Database Driver Guide

Sponsored by phpLens