I know there have been many similar questions, but as far as I can tell, most of the other people have gotten further than I have...

I'm trying to get a WAMP setup happening.

I've got PHP and Apache running and talking to each other. PHP is in c:\PHP Apache is in it's default program files folder. mySQL is in it's default install location. I have localhost setup at D:\public_html\

2 Answers
2

It would help to open up a command prompt, and navigate to your mysql bin directory (if it isn't in your classpath). From here, login to mysql by:

mysql -uroot -p
use test;

If the 'use test' command returned an error, you know your test database has not been created, so go ahead and create it by:

CREATE TABLE test (
id INT,
data VARCHAR(50)
);

Your php looks fine, and should ideally be able to communicate with the mySQL DB instance named test, so long as such a DB instance is created. I would suggest using packaged WAMP setups like Wampserver or XAMPP, which let you focus on the actual development of your php site, instead of spending those hours on setting up your environment.

Change your or die("Could not connect"); to die(mysql_error()); - this will give you a lot more information about what went wrong.

As far as creating databases etc go, you'll need to use a management tool. PHPMyAdmin is a popular one, personally I prefer SQLYogWebYog Community Edition (they used to have a much better website for it, but clearly they want you to fork out for the paid version)