PDA

View Full Version : Dreamweaver and Connecting to a MySql Database



nicolaou
02-17-2008, 05:28 PM
Hello everyone! This is the first time I write in here . . . furthermore i'm quite new, so please be understanding if something I write sounds a bit naive!

My web site is www.bigbangcentral.com (http://www.bigbangcentral.com)

I am working with Dreamweaver CS3 and want to build dynamic web pages using PHP and MySQL. When I used my computer as a local server I managed to do it successfully and created and connected to the MySQL databases and the whole site worked well (it was my testing/experimenting phase)!

My problem now is how to create a database in my real on line web site? I used the phpAdmin from cPanel and created one (and even put data in it) but I can't find the database file. Shouldn't it be stored in a folder somewhere with the rest of the site files?

Secondly how can I connect from Dreamweaver on my local computer with the database in my site?

What is the MySQL server name I should use in order to create the connection?

Are the username and passwords rewuired the same as the ones to register in cPanel? How can I link my site to the database in here?

In cPanel I also created a dummy user with access to the database and the following connection string was generated:

$dbh=mysql_connect ("localhost", "glsteogb_admin", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("glsteogb_members");

But I can't see how it helps me to build the connection that I want with the database.


Please help me out . . . I've spent ages trying to this plus I haven't found any other articles in here that could help me out.

Watdaflip
02-18-2008, 01:22 AM
No, MySQL databases doesn't store any files on your on your site itself, its closer to the server root, you don't have direct access to it. You can only query the database.

I can't help with that one, I use phpMyAdmin or scripts to access data databases.

To connect remotely to your MySQL database use the ip address of the server. To connect locally use "localhost" (locally as in files on your site that connect to the database).

The username and password are different from your username/password to login to cpanel. It is created by you on the same page you create your database.

The generated code is php code to connect to your database. You have to connect to the database before you can query it.

Heres some php and mysql tutorials
http://www.tizag.com/phpT/
http://www.tizag.com/mysqlTutorial/