SitePoint Sponsor |
|
User Tag List
Results 1 to 11 of 11
Thread: Help Fast!
-
Jan 7, 2003, 20:13 #1
Help Fast!
If i've got say...
PHP Code:$MYSQL[ 'SERVER' ] = "localhost";
$MYSQL['USERNAME'] = "username" ;
PHP Code:function db_connect(){
global $MYSQL;
echo $MYSQL['SERVER'];
echo $MYSQL['USERNAME';
}
-
Jan 7, 2003, 20:28 #2PHP Code:
$MYSQL['SERVER'] = "localhost";
$MYSQL['USERNAME'] = "username";
function db_connect(){
global $MYSQL;
echo $MYSQL['SERVER'];
echo $MYSQL['USERNAME'];
}
db_connect();
-
Jan 7, 2003, 22:21 #3
Thats the thing tho. it doesnt!
-
Jan 7, 2003, 22:29 #4
- Join Date
- Jun 2001
- Location
- Before These Crowded Streets
- Posts
- 9,446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
are you trying to connect or echo the variableS?
-
Jan 7, 2003, 22:31 #5
im just trying to echo the variables from inside the function.
-
Jan 7, 2003, 22:38 #6
- Join Date
- Jun 2001
- Location
- Before These Crowded Streets
- Posts
- 9,446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
well, it works for me on Windows XP, PHP 4.2.3....
Aaron
-
Jan 7, 2003, 22:42 #7
is there a certain something that needs to be turned on ?
-
Jan 7, 2003, 22:43 #8
- Join Date
- Jun 2001
- Location
- Before These Crowded Streets
- Posts
- 9,446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
nope register_globals is off on my pc.
-
Jan 7, 2003, 22:51 #9
Hrm very strange.
-
Jan 7, 2003, 23:03 #10
i tried just this
PHP Code:<?PHP
$test = "asdasdsad";
function testing(){
global $test;
echo $test;
}
testing();
?>
-
Jan 8, 2003, 00:32 #11
- Join Date
- Jan 2003
- Posts
- 46
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What version of PHP/Platform are you running on?
Also try:
PHP Code:<?PHP
$MYSQL = array();
$MYSQL['SERVER'] = "localhost";
$MYSQL['USERNAME'] = "username";
function db_connect(){
global $MYSQL;
echo $MYSQL['SERVER'];
echo $MYSQL['USERNAME'];
}
db_connect();
?>
Bookmarks