PHP Classes

File: examples/IfComposer/example6.php

Recommend this page to a friend!
  Classes of Barton Phillips   Simple Site Class   examples/IfComposer/example6.php   Download  
File: examples/IfComposer/example6.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple Site Class
Simple Site Class
Author: By
Last change:
Date: 4 months ago
Size: 1,367 bytes
 

Contents

Class file image Download
<?php
$_site
= require_once(getenv("SITELOADNAME"));

$S = new SimpledbMysqli($_site);

// There is more information about the mysql functions at https://bartonlp.github.io/site-class/ or
// in the docs directory.

$sql = "create table if not exists barton.test (`name` varchar(20), `date` datetime, `lasttime` datetime)";
$S->query($sql);
for(
$i=0; $i<5; $i++) {
 
$name = "A-name$i";
 
$S->query("insert into barton.test (name, date, lasttime) values('$name', now(), now())");
}
$sql = "select * from barton.test order by lasttime";

// For more information on dbTables you can look at the source or the documentation in the docs
// directory on on line at https://bartonlp.github.io/site-class/

$T = new SimpledbTables($S);
$tbl = $T->maketable($sql, ['attr'=>['id'=>'table1', 'border'=>'1']])[0];

$S->query("drop table barton.test");

echo <<<EOF
<p>Here are some entries from the 'test' table.</p>
<p>We are using the SimpledbMysqli and SimpledbTables class. We can't have \$top or \$footer.
Also, isBot() and many more things are not in the SimpledbMysqli class.</p>
$tbl
<hr>
<a href="example1.php">Example1</a><br>
<a href="example2.php">Example2</a><br>
<a href="example3.php">Example3</a><br>
<a href="example4.php">Example4</a><br>
<a href="example5.php">Example5</a><br>
<a href="example6.php">Example6</a><br>
<a href="../phpinfo.php">PHPINFO</a>
EOF;