Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

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.

left Zymic Webmaster ForumsZymic Free Web HostingDatabases & MySQL right
  Reply to this topic Start new topic
left right
Slunk3R
post 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
Go to the top of the page 
 
  + Quote Post
dimon2242
post 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());
}
?>
Go to the top of the page 
 
  + Quote Post
Slunk3R
post 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?
Go to the top of the page 
 
  + Quote Post
Ed
post May 4 2009, 10:22 AM
Post #4


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 2,526
Joined: 11-March 07
From: UK
Member No.: 9



You need to select your database:
http://www.php.net/mysql-select-db


Go to the top of the page 
 
  + Quote Post
Slunk3R
post May 4 2009, 10:24 AM
Post #5


Newbie
*

Group: Members
Posts: 3
Joined: 27-April 09
Member No.: 92,792



QUOTE(Bread @ May 4 2009, 10:22 AM) *
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!
Go to the top of the page 
 
  + Quote Post
 Reply to this topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 21st November 2009 - 04:53 AM