(Bootstrap.php) using current Databaseconnection in output.php file?

(Bootstrap.php) using current Databaseconnection in output.php file?

herrvonundzuherrvonundzu Posts: 2Questions: 0Answers: 0
edited November 2013 in Editor
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

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Hi,

    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
  • herrvonundzuherrvonundzu Posts: 2Questions: 0Answers: 0
    thank you ... worked for me.
This discussion has been closed.