chiefrokka Posted August 5, 2008 Share Posted August 5, 2008 I have someone installing my script on their server and their getting the error: Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/blahblahblah/public_html/pickem/config.php on line 11 my config.php is <?php //make changes accordingly to your database $hostname = "hostname"; $database = "database name"; $username = "username"; $password = "password"; // only change the above information to reflect the database you created on your hosting site $db = mysql_connect($hostname, $username, $password); $db_select = mysql_select_db($database, $db) or mysql_error(); ?> I had someone else have this same problem but I realized they were using mysql 4.1 and I'm using 5.0 on GoDaddy. This latest server config that's giving same issues seems to be fine though? Apache version 2.2.8 (Unix) PHP version 5.2.6 MySQL version 5.0.51a-community Architecture i686 Operating system Linux My GoDaddy is using php 4.1 and mysql 5.0 and the scripts work great as well as it does on other servers except this guys. any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/ Share on other sites More sharing options...
DarkWater Posted August 5, 2008 Share Posted August 5, 2008 They must have the wrong connection details? Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608099 Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 change this $db = mysql_connect($hostname, $username, $password); to $db = mysql_connect($hostname, $username, $password) or die (mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608100 Share on other sites More sharing options...
chiefrokka Posted August 5, 2008 Author Share Posted August 5, 2008 ok, I'll tell him to give that a try. I'm gathering he'll still get the error though won't he? that's just going to die or spit out a better error msg maybe? Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608110 Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 yes, it will just show what the error is Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608111 Share on other sites More sharing options...
revraz Posted August 5, 2008 Share Posted August 5, 2008 It will tell him why he can't connect to the server. But you can also tell him to just check his DB server information. Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608116 Share on other sites More sharing options...
chiefrokka Posted August 5, 2008 Author Share Posted August 5, 2008 he got error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ccteamoh_wrqk'@'alexandria26.2mhost.com' (using password: YES) in /home/ccteamoh/public_html/pickem/config.php on line 10 Access denied for user 'ccteamoh_wrqk'@'alexandria26.2mhost.com' (using password: YES) Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608118 Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 then its either the wrong username or hostname or password Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608125 Share on other sites More sharing options...
chiefrokka Posted August 5, 2008 Author Share Posted August 5, 2008 ok. as long as it's not my end. is it true that this code won't work with mysql 4? Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608136 Share on other sites More sharing options...
revraz Posted August 5, 2008 Share Posted August 5, 2008 Should work for 4. Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608165 Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 it should work on any i think, just need the correct details Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608166 Share on other sites More sharing options...
chiefrokka Posted August 5, 2008 Author Share Posted August 5, 2008 weird. I checked and everything seems correct. I had him make another db and user and still same error. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ccteamoh_wrqk2'@'alexandria26.2mhost.com' (using password: YES) in /home/ccteamoh/public_html/pickem/config.php on line 10 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/ccteamoh/public_html/pickem/config.php on line 11 Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608174 Share on other sites More sharing options...
revraz Posted August 5, 2008 Share Posted August 5, 2008 The User ID he is using doesn't have the rights to perform that action. He is probably using the wrong user id for the DB or he should check the rights that user id has. Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608176 Share on other sites More sharing options...
DeanWhitehouse Posted August 5, 2008 Share Posted August 5, 2008 Are you sure the hostname is correct? Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608178 Share on other sites More sharing options...
chiefrokka Posted August 5, 2008 Author Share Posted August 5, 2008 I just made sure "All Privileges" was checked for those usernames and they were. I also double checked the hostname under system variables and that is correct as well. has me baffled why it doesn't work Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608180 Share on other sites More sharing options...
revraz Posted August 5, 2008 Share Posted August 5, 2008 Sounds like communcation from the webhost may have a problem to the DB. Same webhost for the php as the mysql? Do they have restrictions? I know Godaddy won't let you use mysql with their windows servers, only their Unix/Linux ones. Maybe their host has a similiar restriction. Don't use the IP of the mysql host either, many times they give you a special servername to use for the mysql servers. Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608184 Share on other sites More sharing options...
chiefrokka Posted August 5, 2008 Author Share Posted August 5, 2008 ya, I checked and it's linux as I had that problem with GoDaddy's Windows before. I'm using the hostname not the ip as well. I just deleted the db myself and usernames and redid everything but still getting error. if it's not my syntax I have no clue as I've confirmed everything is right. oh well. thanks anyways guys Quote Link to comment https://forums.phpfreaks.com/topic/118176-warning-mysql_select_db-supplied-argument-is-not-a-valid/#findComment-608191 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.