Eric, When the page gets reloaded it "forgets' the variables passed to it from the previous page. Try putting the log in information and anything else needed in hidden fields in your form. Hugh ----- Original Message ----- From: "eric" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, December 12, 2002 11:58 AM Subject: [PHP] Re: Problems connecting to a MySQL database
> A prompt? Not sure I understand. > > The first time around it connects ok with PHP. I can retrieve all the rows. > It's the 2nd time where it doesn't. > > Jeff Bluemel wrote: > > > have you tried connected to the mysql database from a prompt before using > > php??? > > > > > > "Eric" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> 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 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php