<?php
/* SAMPRE TABLE
CREATE TABLE `user` (
`ID` INT NOT NULL AUTO_INCREMENT ,
`Name` VARCHAR( 50 ) NOT NULL ,
`Age` INT NOT NULL ,
`Profile` VARCHAR( 50 ) NOT NULL ,
UNIQUE (
`ID`
)
)
ENGINE = innodb;
INSERT INTO `user` ( `ID` , `Name` , `Age` , `Profile` )
VALUES (NULL , 'John Doe', '27', 'Administrator'),
(NULL , 'Leonard Euler', '87', 'Common User'),
(NULL , 'Tomas Schweizer', '27', 'PHP Developer'),
(NULL , 'Jackson Freitas', '27', 'Common User');
*/
?>
<style>
.tableClass{
background:#CCCCCC;
border:1px solid black;
font-size:9px;
font-family:Arial, Helvetica, sans-serif;
}
.oddLines{
background:#FFFF99;
}
.evenLines{
background:#FFFFCC;
}
.headingCSS{
background:#FF6600;
text-align:center;
}
.column1{
background:#909999;
text-align:right;
}
.column3{
font-weight:bolder;
color:gray;
text-align:center;
}
</style>
<?php
include ('class.mySqlQuery2Table.php');
$query = "SELECT ID as 'User Code', Name, Age, Profile FROM user ORDER BY Profile";
// If you already have an active connection, just ignore the last four parameters.
// Create the object like:
// $table = new mySqlQuery2Table($query);
$table = new mySqlQuery2Table($query,'localhost','user','password','database_name' );
//For description, see the class documentation
$table->tableCSS = 'tableClass';
$table->header = TRUE;
$table->headerCSS = 'headingCSS';
$table->lineOddCSS = 'oddLines';
$table->lineEvenCSS = 'evenLines';
$table->lineAlternate = TRUE;
$table->columCSS = array('column1', NULL, 'column3');
$table->columFunctionAdd= array('echo "<input type=\'checkbox\' name=\'usuarioID[$element]\']>";');
$table->columFunctionLocation= array(0);
$table->elementFuncion= array(NULL,'echo strtoupper($element);', 'echo $element." years";');
$table->createTable(); // Creating Table
?>
|