Re: PHP Apache (GLOBALS) question
| From: | John Nichel | Date: | Fri, 19 Sep 2003 14:58:23 +0000 |
| Subject: | Re: PHP Apache (GLOBALS) question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-163149@lists.php.net to get a copy of this message | ||
Frank Tudor wrote:
I can run mysql from a command line. What I create a connection string using my php.ini file I get failure. mysql_connect() errors My connection string code is very simple: <?php //list_db.php $link_id = mysql_connect("localhost", "username", "password"); $result = mysql_list_dbs($link_id); $num_rows = mysql_num_rows($result); while($db_data = mysql_fetch_row($result)) { echo $db_data[0]. "<BR>"; $result2 = mysql_list_tables($db_data[0]); $num_rows2 = mysql_num_rows($result2); while($table_data = mysql_fetch_row($result2)) echo "--" . $table_data[0]. "<BR>"; echo "==> $num_rows2 table(s) in " . $db_data[0] . "<P>"; } ?> Using this as a test and all my other connection strings residing on my include file or one the same page as my code fails. --- Jay Blanchard <jay.blanchard@niicommunications.com> wrote:Echo out mysql_error() after your connection attempt. -- By-Tor.com It's all about the Rush http://www.by-tor.com[snip] I have installed Mandrake Linux and it comes standard with Apache PHP and MySQL. You can install all these rpms through the server selection....Anyway. In my test environment it is function city and of course register globals were on. Now I have Taked my PHP.INI-DIST set the globals to on and copied it to my /etc directory. It worked like a charm....but guess what. I can't create a connection string to my database. Now I have to find a solution to get this website to work with globals on and mysql. I have tried adding an .htacess with the php globals override thing php_value "register_globals" "1" Ok this didn't work. So I found the Mysql-PHP RPM on my mandrake cd (of course enabling my php.ini file) and it didn't work. I'm getting closer to a solution but I am stuck. Why won't the htaccess file work? I would like to use my php.ini file but it is not configured for mysql, how could I fix this? Is there anything I can do for either of these two questions to get my globals on? I swear I will never use functions again if someone helps me. [/snip] Actually this sounds like a bunch of mutually exclusive things. 1. Can you run MySQL from the command line? 2. Register_globlas has nothing to do with the connection string to MySQL 3. Can you show us your connection string code?