PHP Classes

compPHP HTML Components: Generate HTML elements linked to database data

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (24)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 143 All time: 9,165 This week: 455Up
Version License PHP version Categories
components 1.0GNU Free Document...7HTML, PHP 5, Databases
Description 

Author

This package can generate HTML elements linked to database data.

It provides classes that can connect to a database using PDO and execute queries to access data from that database.

The package also provides classes that use the database data and display or edit that data in a convenient way for the application. Currently it provides classes for controls like displaying data in tables, render forms with buttons, list boxes, text inputs, combo boxes, etc..

Picture of Rene Gonzalez
Name: Rene Gonzalez <contact>
Classes: 1 package by
Country: Mexico Mexico
Age: ???
All time rank: 428952 in Mexico Mexico
Week rank: 295 Up6 in Mexico Mexico Up

Example


<?php

require_once '../Connection.php';
require_once
'../DataAccess.php';

#Open connection
#Create instance of Connection
$conn = new Connection('localhost', 'test', 'root', '');
#Create simple connection
$link = $conn->SimpleConnectionPDO();

//********************************************************************************************************************* */

#Execute query
#Create instance of DataAccess
$exec = new DataAccess();

#Pass parameter Connection
$exec->SetConn($link['obj_']);

#CRUD Create, Read, Update, Delete
#======================================================================================================

$exec->setQuerycmd("Read");
$exec->setQuerycrud("SELECT id, val1, val2, val3 FROM pruebas;");

$dats = $exec->ExecuteCommand();

#======================================================================================================

require_once '../DataTable.php';

$dt = new DataTable();
#LINK $dats['obj_'] to ComboBox
$dt->SetDataSource($dats['obj_']);
#[OPTIONAL SetHeader()]
$dt->SetHeader(array('Id', 'Brand', 'Type', 'Item'));
$dt->SetID('dtSmartPhones');
$dt->SetClass('table table-dark');
$dt->SetStyle('#dtSmartPhones{font-size:18px; width:65%;}');
$dt->SetBtnSelect(array('show'=>true,
                       
'name'=>'Seleccionar',
                       
'onclick'=>'SelectRow()',
                       
'class' => 'btn btn-success',
                       
'param'=>'id',
                       
'colname'=>'Seleccionar'));
$dt->SetBtnEdit(array('show'=>true,
                       
'name'=>'Editar',
                       
'onclick'=>'alert()',
                       
'class' => 'btn btn-warning',
                       
'param'=>'id',
                       
'colname'=>'Editar'));
$dt->SetBtnDelete(array('show'=>true,
                       
'name'=>'Delete',
                       
'class' => 'btn btn-danger',
                       
'onclick'=>'console.log()',
                       
'param'=>'id',
                       
'colname'=>'Eliminar'));

$dt->SetScript('function SelectRow(id) { document.getElementById("Msg").innerHTML = "You have selected row: " + id; } ');

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <title>Document</title>
</head>
<body style="margin:1em;">

    <?php
       
echo '<style>.Table{ border-style: dotted; }</style>';
        echo
$dt->CreateDataTable();
   
?>
<br><div id="Msg"></div>

</body>
</html>


Screenshots  
  • ComboBox.png
  • DataTable.png
  Files folder image Files  
File Role Description
Files folder image.vscode (1 file)
Files folder imagedemos (4 files)
Plain text file BSCard.php Class Class source
Plain text file BSNav.php Class Class source
Plain text file Button.php Class Class source
Plain text file ComboBox.php Class Class source
Plain text file Connection.php Class Class source
Plain text file DataAccess.php Class Class source
Plain text file DataTable.php Class Class source
Plain text file DateIntervalFunc.php Class Class source
Plain text file Form.php Class Class source
Plain text file ListBox.php Class Class source
Plain text file Login.php Class Class source
Plain text file MSFooter.php Class Class source
Plain text file MSNav.php Class Class source
Plain text file QueryCreator.php Class Class source
Plain text file Select.php Class Class source
Plain text file StringQueryCreator.php Class Class source
Plain text file TextArea.php Class Class source
Plain text file TextBox.php Class Class source
Plain text file WrapControl.php Class Class source

  Files folder image Files  /  .vscode  
File Role Description
  Accessible without login Plain text file launch.json Data Auxiliary data

  Files folder image Files  /  demos  
File Role Description
  Accessible without login Plain text file DemoComboBox.php Example Example script
  Accessible without login Plain text file DemoConnectionDataAccess.php Example Example script
  Accessible without login Plain text file DemoDataTable.php Example Example script
  Accessible without login Plain text file DemoStringQueryCreator.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 92%
Total:143
This week:0
All time:9,165
This week:455Up