By: Valterci
Date: 2006-11-24
Time: 00:19
|
TBS and txtSQL
HI SKROL,
i am making a small application using an archive flatfile called txtsql.
I am using the TBS to show the research result.
Necessary of one plugin TBS to have access the data in txtSQL.
It can help me?
It sees code PHP that I use without the TBS:
<?php
$username = 'root';
$password = '';
define('TXTSQL_CORE_PATH', '../../');
include_once('../../txtSQL.class.php');
$sql = new txtSQL('../../data');
$sql->connect($username, $password);
$sql->selectdb('cotira');
$results=
$sql->execute('select',
array('select' => array('id', 'descricao'),
'db' => 'cotira',
'table' => 'config',
// 'where' => array('id = 2', 'and', 'descricao =~ Noticias'),
'limit' => array(0, 100)));
foreach ( $results as $key => $row )
{
print "ID: $row[id], DESC: $row[descricao]<BR>\n";
}
$sql->disconnect();
?>
|
By: Skrol29
Date: 2006-11-25
Time: 21:07
|
Re: TBS and txtSQL
Hi Valterci,
txtSQL is a very interesting tool, I didn't know it.
Do you know SQLite wich is also a non-server database system ? SQLite databases are files that can be copied and moved, just like txtSQL. SQLite is available for PHP 5 as an extention given in the bundle.
I can easy make a TBS database plug-in for txtSQL but it seems superfluous to me because txtSQL returns the result of a query directly as a PHP array.
So you can do like this:
$query = array('select'=>array('id','descricao'), ...);
$results = $sql->select($query); // $sql->select() is supported since txtSQL version 2.2
$TBS->MergeBlock('b1',$results);
|
or:
$query = array('select'=>array('id','descricao'), ...) ;
$TBS->MergeBlock('b1',$sql->select($query));
|
|