|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dear friends
I'm starting with PHP, and I have any questions: How interchange the values of global variables between different files of php's scripts? By example in file bdgeo.php3 $bd contains the link to an open data base this file call to other file named b1.php3 in file b1.php3 $db is unknow! I think that the connection to the database should make only one time, in first script. In other way, How I maintain active the database connection among the different pages? Can somebody help me? Thank you Luis A. Gonzalez BCN |
|
#2
|
|||
|
|||
|
Nope, you have to re-establish the database connection on the next page. In the background, PHP may be using a persistent connection, but that depends on configuration.
Easiest way to do this is make an include file that has the database connection command(s) and then 'require("<file>.inc"); at the top of each script that needs a database. Then if anything ever changes (location of DB, name, etc), you only have to change the parameters once... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > scope of database conmection |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|