Jump to content
xisto Community
Sign in to follow this  
shadowdemon

Help With A Code

Recommended Posts

i may be bugging people with this but wats wrong with this code

$db = mysql_select_db("shadow_member",$connection)    or die ("couldn't select databse.");


i enetered this code in another code so it would connect to the datavase were the table is but i got this message when i tested it out

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/shadow/public_html/join.php on line 13
couldn't select databse.

Share this post


Link to post
Share on other sites

Well, it sounds like you have not made a connection to the database yet... Have you called the mysql_connect() function? And have you passed it valid parameters??

You should do something like:

$connection = mysql_connect( "server", "username", "password" );$db = mysql_select_db( "shadow_member", $connection )    or die ("couldn't select databse.");

I hope that helps!!

Oh, and if you have used the connect statement already, then make sure it is correct..

Share this post


Link to post
Share on other sites

here is the code that realy works for me and im assuming for everybody too :ph34r: of course..mysql_connect('localhost', 'username', 'password');mysql_select_db('database');so the error is you put 2 arguments to the function mysql_select_db()when it only need one..its a better idea too to use single qoutation mark to speed up compiling

Share this post


Link to post
Share on other sites

Server is usually "localhost". Like post #3 has it.

Share this post


Link to post
Share on other sites

yeah you should used 'localhost' if the mysql you are connecting is not in some other server in the web but in your webhost server. if your are using mysql in Xisto webhosting use 'localhost' as server, your cpanel name as user and your cpanel password as password. That should work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.