database connection

  peabody 22:12 09 Jan 2005

I'm trying to get to grips with database connectivity. Using my ISP provided facility phpmyadmin, I created a MySQL database called 'training' with a table called 'basic' (with some name/address fields).
My domain name is (where myname is a substitute for the real one - hope you understand!). The database is named by PHPMyadmin as myname_training.
I now want to create a connection to the database in MS FrontPage using the DB Connection Wizard but can't get the URL of the DB correct. What would be the syntax?
I have tried click here but it fails to connect. I can't suss what it should be! Any suggestions please?

  Taran 22:39 09 Jan 2005

A MySQL connection consists of just a few simple parameters and it is often best to incorporate them into a conncetion file and reference it as an include.

To break that down into plain English, let's say you have twenty pages in a website and they each read from or write to you database. Either you include the database connection information in every page (which equals same code multiplied by 20) or you create a conenction file and reference it as an include in all files requiring the connection.

A connection document holds the settings to connect to your database and one line of code is required in each document that needs to connect.

Most connections are along the lines of:

Your problems is comopounded by the fact that FrontPage does not support MySQL by default, so using the database connection wizard is out, although you can sort of get a connection going locally by setting up an ODBC data source on your PC. Nopthing about that would help you connect to the database on your server though.

Now, assuming you want to connect to your server database using PHP, a very simple connection script would look like this:

$username = "MySQL username goes in here";

$password = "MySQL password goes in here";

$database = "MySQL database name goes in here";

$hostname = "localhost";

$conn = mysql_connect

("$hostname", "$username", "$password")

or die("Invalid server or user.");

mysql_select_db("$database", $conn);

Copy that into a plain text editor like Notepad and save it as dbconn.php

Now, if any of your pages need to connect to your database you should include the above file into your page, like this:



Lots of other clever PHP and HTML code can go in here....


That is how you would reference a PHP to MySQL database connection file into another PHP page, by using the include(""); command.

Now, at this stage you're probably going to tell me that you want to connect using the database wizard or do without.

Or even worse, you're going to tell me you want to use ASP with MYSQL.

If you can let us know whether you are or will be using PHP, or ASP, or if you just want to try the point and click FrontPage tools to do the work for you.

Basically though, MySQL support is not built into FrontPage so you will have to start hard coding your connection at some point.


  Taran 22:46 09 Jan 2005

I should really have added that if you want to try adapting the above sample code, you need to change the relevant details for your own database username, password, host (usually this is localhost) and database name.

Using FrontPage to edit PHP is possible if you want to change a few default settings. It (FrontPage) isn't really the best tool in the world for PHP and most of the ASP it can produce will not run on Chilisoft ASP, which Linux/Apache web servers rnu as an ASP interpreter, so you could have to consider alternative options here.

MySQL and PHP are an interesting topic to get to grips with and offer a great deal of power and flexibility to any web developer.

They aren't a happy couple with FrontPage though.

You could always go for a Windows web hosting account that offers full ASP and Access database support. That way you get to use the point and click tools that FrontPage has available and you can rnu anything it outputs on your web space.

Just a thought.

  peabody 11:58 10 Jan 2005

Thanks yet again, Taran, for the time and effort you put into responding to requests for assistance. You deserve a medal!

Perhaps I was expecting a bit too much of FP. I also have Dreamweaver but was trying to keep things simple!

This is just a matter of self-education - I've been involved in producing/maintaining 'promotionsl' sites for a while but want to be able to tackle more technical stuff in the future.

I'll paly around with your suggestions and will no doubt ask for further help in the future.

Are there any good 'educational' sites that could help me get to grips with things?

Thanks again.

  peabody 12:23 10 Jan 2005

I thought it might be sensible to follow the Dreamweaver tutorial on creating a web-application. Before I start, however, I have to set up the Dreamweaver work environment for creating dynamic pages.

I am offered a 'multiple choice' of setups: setip for a Coldfusion site,, asp, jsp, or php. Which would it be best to run with, for now at least? asp sounds very familiar to me - will that be good enough for now?

By the way, I see Dreamweaver is happy to use an MS Access db - and I know Access quite well. But it all seems to be MySQL and PHP on the web. Should I bite the bullet and get to grips with the latter?


  Taran 13:15 10 Jan 2005

If your web host already supports PHP and MySQL then you only have two real choices:

1. Go with what you have available


2. Move hosts to a Windows server that supports ASP and Access or .NET and MS SQL

If you have broadband it can be convenient when you first start out to upload your PHP programs direct to a sub-folder on your web server for testing, but if you are stuck on narrowband for whatever reason setting up a local testing server on your own computer makes sense. This allows you to write your web programs and test them on your own PC as if they were on a 'live' web server.

If you plan on getting into this seriously you will have to install a testing server at some stage.

If you want to do this, post to that effect, and if you supply details of your operating system that would also help - Windows 2000 and XP Pro have an optional component called IIS (Internet Information Services) which can deal easily with ASP and Access databases by default. With a bit of extra tweaking and a couple of downloads it can also cope with .NET and MS SQL, and with still more tweaking and downloads it will deal with PHP and MySQL as well.

An alternative is to just install Apache, MySQL and PHP on your computer for testing your PHP/MySQL programs, but this won't allow you to play with ASP and Access.

That is why I need to know both your operating system and whether you want to go with ASP/Access or PHP/MySQL.

PHP/MySQL is capable of far more than ASP/Access, but either are fine to start with.

You need a testing server to use the Dreamweaver dynamic site tutorial though.

The DeveloperSide.NET site click here has a superb preconfigured Apache server available for download which saves you trying to install all the required elements individually.

You should use the superb phpMyAdmin click here for playing with MySQL databases. Learning how to use the command line is important and also not as scary as you might think, but for general use phpMyAdmin puts a pretty interface onto your MySQL databases and allows you to play with them in a visual mode. It is am integral part of the DeveloperSide.NET web server download.

However, post with more detail and one of us will advise further. It might be better to make some choices early on and stick with them. Migrating at a halfway point from one platform to another is a headache, so I suggest you stick either with ASP/Access or PHP/MySQL and since your host already seems to support the latter that would be my own suggestion for you.


  peabody 17:51 10 Jan 2005

I have Windows XP Home and broadband connection. I am happy to run with PHP and MySQL.

I seriously intend getting to grips with all this and hopefully will be able to use it in anger some time. So I have no problem with installing a testing server. I have downloaded the standard self-installing package from and will install later.

phpMyadmin looked pretty user-friendly when I tinkered with it last night. I shall tinker more!

OK so far? This thread could end up as 'the dummies guide to dynamic web design'!


  Taran 02:27 11 Jan 2005

The DeveloperSide.NET preconfigured Apache server is superb. It takes a lot of the hassles out of installing and especially configuring your testing environment. Just follow the enclosed instructions in the readme1st.txt document and make certain you follow them to the letter.

The only additional installs you might like to add are the Zend optimiser click here (not essential but nice to have) and the relatively new MySQL Administrator click here which is a really nice desktop GUI to allow interaction with your MySQL databases.

Aside from that you will need to manually configure the PMA database if you want to be able to generate PDF database diagrams from phpMyAdmin, but if you aren't bothered about this then you can leave well alone.

I say go for it and have fun. The DeveloperSide.NET works very nicely on Windows machines and Dreamweaver works well with it too.

  peabody 19:50 11 Jan 2005

Installation of test server and configuration complete and DW tutorial now under way. Slow but sure - a little like wading through treacle.

One thing - the only 'Global Cars' database I can find is an Access .mdb file which isn't supported under PHP. So I've created a small table using phpMyAdmin to tinker with. I find myself jumping around from DW to phpMyAdmin, back and forth, which is a tortuous route to learning. Any idea where the DW test database is? Thanks

  Taran 00:55 12 Jan 2005

Navigate to C:\Program Files\Macromedia\Dreamweaver MX 2004\Samples\Database

In that folder there is a file called insert.sql

It contains the SQL statements necessary to create your database tables with sample content.

You can name your database anything you like, but make sure you remember it so you can connect to it !

Full details of this, and all other aspects of setting up the PHP sample site are contained in the Dreamweaver help files.

Click on Help, select the top option called "Getting started and tutorials". Right down near the bottom of the list of options is the 'Setup for sample PHP site' section. All the information you need to get up and running is in there.

Have fun !

  harristweed 13:02 12 Jan 2005

Its quite simple to export a cooma delimited text file from access and then import it in to mysql using mysqladmin.

Then you can use the data with PHP.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

See mcbess's iconic style animated for Mercedes-Benz

iPhone X news: Release date, price, new features & specs

Black Friday 2017 : date, sites participants & bonnes affaires