phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


ADOdb: Recordset to HTML

Tag: adodb, database, database layer, grid   Category: PHP Database
post: 30 Oct 2007 read: 966


This is nice feature. It will help us printing recordset as HTML table by easy way. (next sentences from manual) 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:


<?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')); 
?> 


Series this article:
ADOdb: Introduction
ADOdb: Connection Statement
ADOdb: Advance Select Statement
ADOdb: How to show tables
ADOdb: How to show fields
ADOdb: How to show databases
ADOdb: Caching of Recordset
ADOdb: Recordset to HTML
ADOdb: Multi Database Connection
ADOdb: Data Dictionary
ADOdb: Quick Export Data
ADOdb: Insert data style
ADOdb: Replace Data
ADOdb: Log Query
PHP ADOdb: Understanding Pivot Table For Reporting
PHP ADOdb: Creating Pivot Table
PHP ADOdb: Creating Query to Build Pivot Table

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting