close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in

Thread began 12/11/2009 6:48 am by karen.marley367377 | Last modified 12/15/2009 11:54 am by Justin Nemeth | 11003 views | 5 replies |

karen.marley367377

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in

Hi

Have set up a mysql database and working with php.
The connection works fine locally, but when I load to the remote server I get the error:
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in

My host provider seems to think this is a compatibility issue between their versions of mysql (5.0.77) and php (5.1.6) and my local mysql and php.

the offending lines include "mysql_select_db($database_dbname, $dbname);

your help is much appreciated!

Sign in to reply to this post

Justin Nemeth

Double check your login information for the database. The link being invalid means a connection was not made to the database. Your database login info is probably different on your live server.

Sign in to reply to this post

karen.marley367377

Originally Said By: Justin Nemeth
  Double check your login information for the database. The link being invalid means a connection was not made to the database. Your database login info is probably different on your live server.  



I have double checked with the host provider and they assure me that the connection script is correct... Any other ideas? X

Sign in to reply to this post

Justin Nemeth

The link error can really only mean it can't login to your database as far as i know. You might need to turn on PHP errors so you can see the connection error. You can add ini_set('display_errors', 'on'); to the top of your PHP page then run it again. My guess is that will show an error saying the mysql_pconnect call has failed.

$dname is the connection to your MySQL database. With your original error, it means $dbname is null which means it failed to connect to MySQL for some reason.

-justin

Sign in to reply to this post

karen.marley367377

Originally Said By: Justin Nemeth
  The link error can really only mean it can't login to your database as far as i know. You might need to turn on PHP errors so you can see the connection error. You can add ini_set('display_errors', 'on'); to the top of your PHP page then run it again. My guess is that will show an error saying the mysql_pconnect call has failed.

$dname is the connection to your MySQL database. With your original error, it means $dbname is null which means it failed to connect to MySQL for some reason.

-justin  



After speaking to the hosting provider it seems the error was the way that the php duplicated reference to the database.

ie.
mysql_select_db($database_DBNAME, $DBNAME);
mysql_query($query_limit_RSNAME, $DBNAME)

to get this to work I had to change the syntax to:
mysql_select_db(DBNAME);
and take out the reference to the DBNAME as follows:
mysql_query($query_limit_RSNAME).

Would this be anything to do with conflicting versions of php?.

Sign in to reply to this post

Justin Nemeth

I don't think it would be different PHP versions causing this, but I've never come across this issue either. Your changes make sense, that second arguments is actually optional anyway. If you are only using a single database connection (which in your case you seem to be), it will just default to using that connection so that is why removing the 2nd argument works ok.

-justin

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...