Edit: I fixed the problem!

Someone please delete this or something!

Recommended Answers

mark it as solved and it will disappear

Jump to Post

All 2 Replies

mark it as solved and it will disappear

which database engine are you using or which language? you could specify to be helped accordingly.Okay I will assume you are using WAMP and PHP.

This means that you are not propery selecting the databasemay be you misspelled the database name(check properly) or you have an error with your database.If you are using WAMP make sure that you have cleary defined the user and previlages. are you able to connect to the database? if yes then after that connection step select your database
eg:$con = mysql_connect("server","user","password")or die("connection failed".mysql_error());
mysql_select_db("databasename", $con(optional))or die("database not found!".mysql_error());
if you are not able to output "database found!" then it means there is a problem with your design (in the database)
if it is not database design problem, then to overcome it if you are using php and mysql do it step by step to track the source of the error. do not deal with the whole code at once!

eg: $con = mysql_connect("server","user","password") or die ("can not connect!");
echo "connected";

run this if it is able to output connected,then proceed to select database

mysql_select_db("databasename", $con)or die("database not found".mysql_error());
echo "database found";

if you are able to output 'database found 'you are okay you can proceed but if it says database not found,then go back and redesign your database it has got an error!
in summary this is the testing code:

$con = mysql_connect(server,user,password) or die ("can not connect!".mysql_error());
mysql_select_db("databasename", $con)or die("database not found".mysql_error());
echo " database found."

if this works then proceed replace where there is echo"database found" with any code to be executed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.