PHP Classes

PHP HTML Database: Generate HTML from query results programmatically

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Info   Screenshots Screenshots   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2013-02-20 (2 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 299 All time: 6,782 This week: 1,101Up
Version License PHP version Categories  
html-database 1.0.1MIT/X Consortium ...5.2.3HTML, PHP 5, Databases
Description Author  

This package can generate HTML from query results programmatically.

The base class can generate HTML pages by composing the different page tags from parameters like page CSS, JavaScript, meta tags, comments, forms, tables, etc..

It can also generate listings from database query results using separate classes.

Currently several databases supported like MySQL, SQL Server and Oracle.

Picture of Manuel Gonzalez
Name: Manuel Gonzalez <contact>
Classes: 1 package by
Country: Mexico Mexico
Age: 36
All time rank: 348236 in Mexico Mexico
Week rank: 1510 Up17 in Mexico Mexico Up

Details provided by the author  

Write HTML using only php

About the project

One advantage of the dynamic pages and client server languages, is the ability to create multiple contents using the same code. In combination with databases, the possibilities for creating content, grow and can facilitate or complicate the existence of a programmer. The main idea of this project, is precisely to facilitate the generation of these contents when the origin of these come from different sources.

This project was done in my spare time. Not intended to replace the good programming practices, and serve as a example for stable development. The project is the result of a question "what if...?"


The PHP2HTML class, integrates engine access to MySQL, SQL Server and Oracle. Allowing the automation of building several web pages, using the same code. It allows to integrate in a same page from different sources. 
For example, the menu can be in a text file, get the main page from a MySQL database and other items are stored at Oracle database

  - Import CSS/JS/Text/Php Files
  - Use the same methods to access different RDBMS
  - Common methods to build most used tags
  - Object-oriented
  - Automate events

  - PHP 5.2 or higher
  - MySQL 4.1 or higher
  - Oracle 9 or higher
  - Microsoft SQL Server 2000 or higher

The use of Oracle is not limited to full versions. XE versions are supported.  
To use the mysqli extension, you must have installed mysql 4.1 or higher. 

  include_once 'html.class.php';
  $p = new PHP2HTML();
  $p->Body('<div>Hello World</div>');
  $p->Comment("Begin of imported file");
  $p->Comment("End of imported file");
  $p->Body($p->Link(PAGEF, "","Google","_blank"'));
            "button", "Click Me", "myClass", "myID", "myName",
              'alert("Hello"); return false;'

Database connections example
    $p->setConnection($dbHost, $db_User, $db_Pass, $db_Database);

    //Running a SELECT statement
    $p->Cnn->Query('Select code, name from myTable');

    //The result of the query can be accessed via Cnn->rs method
      //The numRows() method returns the number of rows for a SELECT query 
      $NumRows = $p->Cnn->numRows();
      echo "The statement return $NumRows records";

    //Running a Delete statement
    $p->Cnn->Query('delete from myTable where code = 101');

      //Returns the number of affected rows on success
      $NumRecords = $p->Cnn->affectedRows();
     echo "The statement affect $NumRecords rows";
Constructive critics, comments and suggestions are welcome.


  • example
  • database
  Files folder image Files  
File Role Description
Plain text file actions.class.php Class Class source
Accessible without login Plain text file html.actions.php Aux. Auxiliary script
Accessible without login Plain text file html.attributes.ext.php Aux. Auxiliary script
Accessible without login Plain text file html.attributes.php Aux. Auxiliary script
Plain text file html.class.php Class Class source
Accessible without login Plain text file html.def.php Conf. Configuration script
Accessible without login Plain text file MIT-LICENSE.txt Doc. Documentation
Plain text file mssql.class.php Class Class source
Plain text file mysql.class.php Class Class source
Plain text file mysqli.class.php Class Class source
Plain text file oracle.class.php Class Class source
Accessible without login Plain text file Doc. Auxiliary data
Plain text file sqlfunctions.class.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 86%Total:299All time:6,782
 This week:0This week:1,101Up