Developer's Manual  Function Reference  Database Functions  suSQLConnect

suSQLConnect

Creates connection to the MySQL database and a new instance of suSQL class.


suSQLConnect
(array connection_parameters);
where connection_parameters is array of the following format:

<?
$suSQL
= Array(
    
'type' => 'mysql',
    
'db'   => 'db_name',
    
'host' => '',
    
'port' => '',
    
'user' => '',
    
'pswd' => '',
);
?>

SiteSupra calls the function on every page load using data stored in .htsupra configuration file. If your blocks or modules work with the same database specified in the configuration you should not call the function in your scripts again. Once connection and suSQL class instance were created by SiteSupra you can refer to the class methods. Only if you wish to connect to another server you have to create another connection using the suSQLConnect function.

It is recommended using database.table syntax in SQL queries, rather than creating a new connection to another database at the same server.

Please login to add comments.