No database selected Error plzz help expert mysql master

Started on the old forum in April 2012 · view the original in the archive · old links redirect here

#database #error #mysq

7 replies · 677 views · started 14 years ago · 1 min read

5 participants
arbind004 Junior · 13 posts #1
<?php
$conn = mysql_connect("localhost","star_zedge","password","true") or die(mysql_error());
mysql_select_db("star_game",$conn);
$sql = "SELECT * FROM 176x220";
$result = mysql_query($sql,$conn) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {  
        echo"<br/>";
	echo"Filename: {$row['filename']}";
        echo"<br/>";
}
?>

i got this error "No database selected" i have created star_game name database but when try to connect star_game database then i get this "No database selected" error but when i connect another database then work fine with this code. i think its phpmyadmin problem plzz expert masters any say solution of this problem

something else Fellow · 2,296 posts #2

watch the video tutorial on your server (if there is one) on setting up your database you will see where you have gone wrong 😛

arbind004 Junior · 13 posts #3

plzz help expert..

Added after 2 minutes:

i have craeted 7database and connect by using multiple databases. but i have problem in one database it now showing by sql quary.

something else Fellow · 2,296 posts #4

is this off of the same server? icedroplets had a similar problem where he had to create a Main daatbase name and then assign the database names to the main one .... then change the local_host to the main database name.

arbind004 Junior · 13 posts #5

Ok, thats problem solved, Problem in the cpanel phpmyadmin. i have changed cpanel now working fine.

Busary Junior · 14 posts #6

Please tell me how you solved it

arevel Newbie · 4 posts #7

i guess u have error on your config username or password. .

anil14353 Newbie · 8 posts #8

arbind004 wrote:

<?php
$conn = mysql_connect("localhost","star_zedge","password","true") or die(mysql_error());
mysql_select_db("star_game",$conn);
$sql = "SELECT * FROM 176x220";
$result = mysql_query($sql,$conn) or die(mysql_error());
while ($row = mysql_fetch_assoc($result)) {  
        echo"<br/>";
	echo"Filename: {$row['filename']}";
        echo"<br/>";
}
?>

i got this error "No database selected" i have created star_game name database but when try to connect star_game database then i get this "No database selected" error but when i connect another database then work fine with this code. i think its phpmyadmin problem plzz expert masters any say solution of this problem

I think the one you are trying to connect the database does not exist.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close