jwk811 Posted October 3, 2006 Share Posted October 3, 2006 Warning: mysql_connect(): Can't connect to MySQL server on 'mysqladmin2.secureserver.net' (111) in /home/content/j/w/k/jwk811/html/db.php on line 10Unable to connect to database! Please try again later.And heres my db.php file. Can you tell me what I'm doing wrong? [code]<?php//Connect To Database$hostname="mysqladmin2.secureserver.net:43998";$username="091381";$password="(mypassword";$dbname="091381";$usertable="users";$yourfield = "uderid";mysql_connect($hostname,$username, $password) OR DIE ("Unable to connect to database! Please try again later.");mysql_select_db($dbname);$query = "SELECT * FROM $usertable";$result = mysql_query($query);if($result) { while($row = mysql_fetch_array($result)){ $name = $row["$yourfield"]; echo "Name: ".$name; }}?> [/code]I can see that the die part is coming up in the script. What would make it do that? I think there might be something wrong with the hostname.. I'm using phpMYadmin does that look like the right thing for host? Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 3, 2006 Share Posted October 3, 2006 Assuming the other things are correct, it probably is something to do with the host name. I would verify that that is the right host. The syntax looks fine though. Quote Link to comment Share on other sites More sharing options...
JustinK101 Posted October 3, 2006 Share Posted October 3, 2006 Verify the following:$hostname="mysqladmin2.secureserver.net:43998";$username="091381";$password="(mypassword";Your problem lies in either hostname, username, or password. The port number in the hostname seems very odd, usually MySQL is never run on such a high port, try it without the port numbers, so:$hostname="mysqladmin2.secureserver.net"; Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 3, 2006 Share Posted October 3, 2006 Good call. Isn't 43998 above the maximum port number anyway? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 3, 2006 Author Share Posted October 3, 2006 yeah i think i already tried that.. ill try again and see what happens tho, thanks. and i had another questions.. you know with the membership thing in a database.. this code to connect is asking for one field in the table.. dont i want the whole table? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 3, 2006 Author Share Posted October 3, 2006 Warning: mysql_connect(): Can't connect to MySQL server on 'mysqladmin2.secureserver.net' (111) in /home/content/j/w/k/jwk811/html/db.php on line 10Unable to connect to database! Please try again later.eerrrrggggg Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted October 3, 2006 Share Posted October 3, 2006 [code]<?php//Connect To Database$hostname="mysqladmin2.secureserver.net:43998";$username="091381";$password="(mypassword";$dbname="091381";$usertable="users";$yourfield = "uderid";mysql_connect($hostname,$username, $password);mysql_select_db($dbname);echo mysql_error();$query = "SELECT * FROM $usertable";$result = mysql_query($query);if($result) {// stuff here}?> [/code] try that, just with stuff here put your other stuff.Also double check your password, double check your username, replace that connection address with "localhost" and see if that works.If none of that works, then what is the url of your web hosting company. Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 4, 2006 Author Share Posted October 4, 2006 okay i tried that new code and got a bunch of warning saying cant connect to database and cant find a link to connect to server. i think it might have something to do with the password because when i used a fake password to see what would happen the same warnings came up about the connecting but im sure i didnt type in what i thought it was to be wrong. im using the same pasword that i use to log into my database or my account on phpmyadmin right? And ive tried a lot to find out why i cant connect and i still dont know what to do. is there anyone out there that could try it out for me? and see what the problem is and if its just me or whatever. ive had this same problem a while ago about not connecting and gave up for a while because i just couldnt find out what the problem was. thanks for the help! Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 4, 2006 Share Posted October 4, 2006 Can't you actually find out the connection string from your web host (or the piece of paper on which you wrote the information when you created the database)? Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 4, 2006 Author Share Posted October 4, 2006 yeah i have that if i think i know what your talking about.. and im using it Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 4, 2006 Author Share Posted October 4, 2006 andy do you think you could try it if i gave you the password? Quote Link to comment 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.