Edit: I fixed the problem!

Someone please delete this or something!

Edited by Aser Gado: n/a

6 Years
Discussion Span
Last Post by Daniel Liwonde

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.

Edited by Daniel Liwonde: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.