Categories > TinyButStrong general >

How to connect and select mysql database ??

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Brij kishor
Date: 2009-05-21
Time: 13:28

How to connect and select mysql database ??

<?php
include_once('classes/tbs_class.php');
$TBS =& new clsTinyButStrong ;
$TBS->LoadTemplate('template/guestbook.html');
$TBS->MergeBlock('Slist', 'mysql', 'SELECT * FROM `guestbook`');
mysql_close($dbc);
$TBS->Show();
?>
i have write a script according to your manual. but mysql connection is not working .
By: Brij kishor
Date: 2009-05-21
Time: 13:48

Re: How to connect and select mysql database ??

I get the solution
<?php
include_once('classes/tbs_class.php');
$TBS =& new clsTinyButStrong ;
$TBS->LoadTemplate('template/guestbook.html');
$dbc  = mysql_connect("localhost", "root", "");
mysql_select_db("tbs",$dbc);
$TBS->MergeBlock('Slist', $dbc, 'SELECT * FROM `guestbook`');
mysql_close($dbc);
$TBS->Show();
?>

but there are any other solution.
By: Skrol29
Date: 2009-05-22
Time: 00:16

Re: How to connect and select mysql database ??

Hi Brij,

Connecting to the database is not the part of TBS. It can be done several ways. The basic way is the on you've coded. You can also use connectivity PHP classes to connect and work with SQL.

I use TbsSQL.
http://www.tinybutstrong.com/tbssql.php