|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 3
|
|
| Author |
|
|
Newbie Joined: Nov 28, 2006 Post Count: 30 Status: Offline |
i am trying just to connect to my database. this is my first time and i seem to be following all that i read correctly. but that can't be the case since i am not connecting. anyway, this is the code that i am using. <?php $me = "myUserID"; $pass = "myPassword"; $host = "mysqladmin2.secureserver.net"; mysql_connect($host, $me, $pass); @mysql_select_db('myDatabaseName) or die( "Error! Unable to connect."); mysql_close(); ?> i also have a port number to connect to. i've tried using localhost in place of $host: mysql_connect(localhost, $me, $pass); I just can't connect. Please help! Thanks |
||
|
|
Advanced Member Joined: Aug 23, 2005 Post Count: 101 Status: Offline |
Hi Duframe, first of all change: mysql_connect($host, $me, $pass); to mysql_connect($host, $me, $pass) or die ( "Unable to connect to database"); This to specifie where the problem is. $host has to be either localhost or a ip number. check your mysql admin or "hosting cpanel" to look for your ip. Kind regards, Zero |
||
|
|
Advanced Member Joined: Jun 14, 2003 Post Count: 2940 Status: Offline |
Here it is a little more complete: $dbh = mysql_connect ("localhost", "killerphp", "<PASSWORD HERE>")or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("killerphp"); ... Note that I am using the function: mysql_error(), to find out what the error was. CIAO Stefan ---------------------------------------- Stefan Mischook Video Tutorial Store | Web Templates ---------------------------------------- [Edit 1 times, last edit by admin at Dec 4, 2006 9:16:04 AM] |
||
|
|
|
|
|
Current timezone is GMT May 23, 2013 12:03:15 AM |