Skip to main content
April 9, 2010
Question

Going from a form to a MySQL db

  • April 9, 2010
  • 3 replies
  • 2569 views

I'm having problems knowing how to create my first MySQL db, I'm using DW CS4 for website development.

I have created two forms, here www.hollisterairshow.com/helpusplan.htm and here www.hollisterairshow.com/feedback/index.html , I know that PHP and MySQL are installed on the server, both of these forms assume an empty db to begin with. I must be missing something very obvious but I can't figure out how to go from having a form defined in a html document to being able to capture input from users and populate the db with their input. I'd really appreciate someone stepping me through the process, or if you could point me to a tutorial that I haven't been able to find yet. In addition to the form data I'd like to capture the date, time and IP address of the user (I may use this later to eliminate duplicate input).  

Thanks so much.

Tony 

This topic has been closed for replies.

3 replies

April 28, 2010

Thanks to all that tried to help, I really appreciated the efforts of you all. My learning curve is really steep....

April 23, 2010

Hi Tony,

I am in exactly the same boat that you were when you made your initial post. Finding this discussion was like finding a large nugget of gold for me. I have multiple things to look at now.

Thanks to all for answering his questions, and don't be surprised if you see one or two more from me.

Best regards,

BrianH.

April 23, 2010

Hi Brian,

This forum was invaluable and got me going in the right direction. Tech support at my web hosting company were as helpful as they could be but they had no-one with DW expertise and didn't even have a copy of DW so they could replicate my problem - it turns out my problems were in DW but for a while I just didn't know where the problems were. My problem appears to be solved so I'll summarize what I did in case it helps you.

After defining my form I couldn't figure out how to connect to a MySQL db. It's obvious now but first step is to go to the Control Panel for your web hosting company and look for MySQL options. I found them and defined the db and one table - which corresponded to my form, one field on the form to one column in the table.

Next I tred to connect (click "Test" on the Testing Server page) and DW couldn't connect to the server. It turned out the problem was that I was using FTP to connect to my web server, which worked fine, but I had checked "Secure FTP" for my Testing Server (you find this under Site/ Manage Sites/yoursite/Edit), when I unchecked this I could connect to the server when I clicked "Test" on the Testing Server page.

So then I went to "Databases" and selected "+" to add a connection and then I was getting an HTTP 404 error - can't find file. It turned out the solution to this was again in the Testing Server settings where DW had set the "URL prefix" to be http://www.hollisterairshow.com/public_html - looks like it just concatenated the entries for "FTP Host" and "Host Directory" which are on the Testing Server page in Site Definitions - the same place I unchecked "Secure FTP".  When I removed "public_html" from the URL prefix, leaving it as http://www.hollisterairshow.com I went to "Databases" again and clicked "+" and it found the db.

Now all I have to do is figure out how to submit my form to the db but at least the web site and the db can talk to each other. All this took roughly two weeks elapsed time, next time it'll take two minutes....sigh.

Tony

April 9, 2010

It doesn't sound like you have even set up a DB yet... you have to create the DB and tables on your hosting server before DW can connect to it. I would contact your hosting providers help section for info on how to create a MySQL database for your hosting account.

April 10, 2010

Thanks, that got me going in the right direction. So now I've created

one database with one table for the "helpusplan" form. So, next step I assume is to connect the form to db right? I'll dig around in DW and try to figure that out. Thanks again.

April 10, 2010

There is a databases window in DW, and you can "add new MySQL connection"...