Date: 02/05/06 (PHP Community) Keywords: php, mysql, database, sql, apache FIXED. Thanks to hipmaestro -- I downloaded PHP 4.3.11 and upgraded my installation, and it's fixed. :) $db_server = 'localhost'; So I include it in almost everywhere. The script's functions is included in a mod_modulename.php file, such as get_this_stuff(); and add_something(); and so on and so forth. For the script I'm using, some user settings are stored in the database, and I have a mod_settings.php file with the following functions: There are a few other functions but those are the ones needed to, er, get the gist of the way they're set up. So now I'm working pretty well, until I come to one page and at the bottom of the page, I get a MySQL error about not being able to connect to the test database. See this (before?) screenshot. I fiddle around, check config, etc etc. Nothing. I look for where the database connect is failing, and it's in get_setting( ... ); so I go there and take a look. I add a few echoes in there, to check my config values and look what happens to the page: whatthehell? I've searched the whole script directory and the ONLY place where I assign a value to $db_user is in config.php; nowhere else. I don't have register_globals turned on, and I don't plan to ever turn it on; and I've checked the $_* arrays, and there is no index of that name. I ended up going to config.php and doing a series of echoes, and did this: echo '$db_user is now: ' . $db_user . ' And that results to this: Notice: Undefined variable: db_user in D:\Site\devt\Enth3\enth3\config.php on line 11 *tears hair out!* It's right before the line and it assigns $db_password. I have no idea what's going on. I commented out the $db_server line and the $db_user line got 'username' as its value. I repeated $db_user twice consecutively, still 'password'. I repeated $db_user twice, the next one after $db_password, and it works. Here's another: I switched the $db_password and $db_database variables, which means $db_database now goes before $db_password. The value of $db_user? It's 'database'. NOT 'databasename', but 'database'. WHAT THE HELL IS GOING ON. I suppose I could make a fix where $db_user goes after $db_password or something, but just the fact that this is happening means that there's just plain something wrong with what's happening, either with the interpreter or my code or... whatever. I don't see what's wrong, and I've exhausted all possible ideas in my head as to what's wrong... can anyone help me? If it might be useful -- the PHP interpreter died on me twice yesterday. I'm not sure why. It just did. Windows XP (SP2) just told me that the PHP interpreter got some errors or something (I forgot what it said) and needs to close. I let it close, I rebooted the computer, and went on. I'm working with Apache 2.0 and PHP 4.3.0 and MySQL 4.0.15 on this machine, which is on Pentium4 2.4 GHz and 480MB memory (512, but the rest is being eaten up by the video card). Any ideas? Help? Suggestions?
|