(Bootstrap.php) using current Databaseconnection in output.php file?
(Bootstrap.php) using current Databaseconnection in output.php file?
herrvonundzu
Posts: 2Questions: 0Answers: 0
hi there...
in bootstrap.php you wrote:
//
// Database connection
// Database connection it globally available
//
$db = new Database( $sql_details );
how is this global available? i want to do a simple select * from databaseXY query on the presistant connection and echo the resulting array... may i use the connection the ajax requested earlier or do i have to open a new one inside the php file where the tableoutput is?
i tried: $query = mysqli_query($db, "SELECT * FROM databaseXY");
please give me a hint... or maybe two. ;)
tnx
in bootstrap.php you wrote:
//
// Database connection
// Database connection it globally available
//
$db = new Database( $sql_details );
how is this global available? i want to do a simple select * from databaseXY query on the presistant connection and echo the resulting array... may i use the connection the ajax requested earlier or do i have to open a new one inside the php file where the tableoutput is?
i tried: $query = mysqli_query($db, "SELECT * FROM databaseXY");
please give me a hint... or maybe two. ;)
tnx
This discussion has been closed.
Replies
Is it in a function you are using the $db property? You could do `global $db;` or `$GLOBAL['db']` . The is more information int he PHP documentation: http://php.net/manual/en/language.variables.scope.php
Allan