Greetings!

I have a script which attempts to connect to the database in three different 
segments of code.

I'm using this code to connect to the database:

$db = mysql_connect("the_host", "the_user", $cfg['Servers'][0]['password']);
.
.
.
.
mysql_close($db);

The first time I connect ok, retrieve all of the rows from a table, and 
display portions of a column.

A user then clicks on a button to retrieve more detailed information from 
the same table in the database:

$db = mysql_connect("the_host", "the_user", $cfg['Servers'][0]['password']);

This bombs with:

Warning: Undefined offset: 0 in (directory stuff)/www/cgi-php4/my_script.php 
on line 228

Warning: Access denied for user: 'the_user' (Using password: NO) in 
(directory stuff)/www/cgi-php4/my_script.php on line 228

Warning: MySQL Connection Failed: Access denied for user: 'the_user' (Using 
password: NO) in (directory stuff)/www/cgi-php4/my_script.php on line 228

Error: Could not connect to the database.


Now, if I change the index to match the exact number of rows in the table, 
it's successfully accessed:

$db = mysql_connect("the_host", "the_user", $cfg['Servers'][4]['password']);

it works fine.  But I don't think this is right.

Any ideas as to why this is happening?

Thanks much!

Eric

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to