Have a PHP/MySQL form with a dropdown box containing a list of 350 names. When any random name is selected, sometimes it works & displays info about that name from the database, and sometimes the form gives the error "No Database Selected".
Here's what I've tried, pretty much grasping at straws as I'm not a programmer:
Adding the word true to this connection string:
$mysql = mysql_pconnect($hostname_mysql, $username_mysql, $password_mysql, true) or trigger_error(mysql_error(),E_USER_ERROR);
Changing the word require_once to require on this line:
[?php require('/home/user/Connections/mysql.php'); ?]
Enabling MySQL & PHP query & error logging. (no errors logged)
Here is the code: [removed old bad code]
Update: Working answer from Rob Apodaca below.
This line: mysql_select_db($database_mysql, $mysql); appears more than once in your provided script. Since the value of $database_mysql does not appear to change, I would remove all of the instances of that line and place it just after the mysql_pconnect/mysql_connect line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With