Error: No Database Selected |
||
Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.
In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.
Zymic Webmaster Forums Zymic Free Web Hosting Databases & MySQL |
||
![]() |
Error: No Database Selected |
||
May 4 2009, 09:52 AM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 27-April 09 Member No.: 92,792 |
Hello everyone,
I've got a question, I uploaded my website, but right now it says: NO DATABASE SELECTED. Here's my database connection: CODE <?php if ($SERVER_NAME == "localhost") $db = mysql_connect('localhost','root'); else $db = mysql_connect('localhost','skyhighheroes_sh','roj14700'); if (!$db) { echo "No connection possible with the database, please contact the administrator<br>"; die("Connect Error: " . mysql_error()); } ?> Can anyone help me with this? I don't know the problem.. Greetings, Slunk3R |
|
|
May 4 2009, 09:54 AM
Post
#2
|
|
|
Newbie ![]() Group: Members Posts: 17 Joined: 31-March 09 Member No.: 89,671 |
CODE <?php
if ($SERVER_NAME == "localhost") $db = mysql_connect('localhost','root'); else $db = mysql_connect('localhost','name-you-site_nameDB','pass'); if (!$db) { echo "No connection possible with the database, please contact the administrator<br>"; die("Connect Error: " . mysql_error()); } ?> |
|
|
May 4 2009, 10:04 AM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 27-April 09 Member No.: 92,792 |
That doesn't work.. That doesn't change anything..
Anyone can help? |
|
|
May 4 2009, 10:22 AM
Post
#4
|
|
![]() Outrageously Uber Ninja ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrators Posts: 2,529 Joined: 11-March 07 From: UK Member No.: 9 |
|
|
|
May 4 2009, 10:24 AM
Post
#5
|
|
|
Newbie ![]() Group: Members Posts: 3 Joined: 27-April 09 Member No.: 92,792 |
You need to select your database: http://www.php.net/mysql-select-db Thanks, I knew I was missing something, I felt like it.. I just couldn't come up with what it was.. Now I know haha. Problem solved, thanks! |
|
|
![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users) |
||
| 0 Members: | ||
Forum Jump |
||
| Lo-Fi Version | Time is now: 22nd November 2009 - 02:15 AM |