|
|
|
|
![]() ![]() |
Sep 27 2005, 04:41 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 210 Joined: 13-September 05 Member No.: 11,799 |
i may be bugging people with this but wats wrong with this code
QUOTE $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. |
|
|
|
Sep 27 2005, 01:11 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 117 Joined: 3-May 05 From: A Canadian South of the 49th Parallel Member No.: 6,544 |
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: CODE $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.. |
|
|
|
Sep 27 2005, 01:38 PM
Post
#3
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 12-September 05 Member No.: 11,777 |
here is the code that realy works for me and im assuming for everybody too
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 |
|
|
|
Sep 27 2005, 02:12 PM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 210 Joined: 13-September 05 Member No.: 11,799 |
thanks ill try these and get back with u with my results i think i figured out wat i did wrong tho i think i used the wrong username and pass but ill check
|
|
|
|
Sep 27 2005, 02:16 PM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 210 Joined: 13-September 05 Member No.: 11,799 |
i used the second one and got this error
Warning: mysql_connect(): Access denied for user: 'shadow_members@localhost' (Using password: YES) in /home/shadow/public_html/join.php on line 13 and im gonna try the first one |
|
|
|
Sep 27 2005, 02:23 PM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 210 Joined: 13-September 05 Member No.: 11,799 |
and for the first one wat do i replace with server (not sure wat u mean by server)
|
|
|
|
Sep 27 2005, 04:38 PM
Post
#7
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,916 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 |
Server is usually "localhost". Like post #3 has it.
|
|
|
|
Sep 27 2005, 10:39 PM
Post
#8
|
|
|
Premium Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 165 Joined: 12-September 05 Member No.: 11,777 |
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 trap17 webhosting use 'localhost' as server, your cpanel name as user and your cpanel password as password. That should work.
|
|
|
|
Sep 27 2005, 10:43 PM
Post
#9
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 210 Joined: 13-September 05 Member No.: 11,799 |
k and local host does that include the number
|
|
|
|
Sep 27 2005, 11:04 PM
Post
#10
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: |