24 Replies Latest reply on Oct 20, 2007 6:00 AM by (Alyssa_Stein)

    Creating a MYSQL connection and database.

      Hello.
      Alright. So I'm attempting to make a log in for my website. And to do this, I need to create a MYSQL connection. I'm not exactly sure what I'm supposed to do. I need to make a database first, and I'm completely lost.
      Can someone please help me create a database?
        • 1. Re: Creating a MYSQL connection and database.
          Günter Schenk Level 4
          Hi Alyssa,

          do you mean creating the database tables required for ADDT´s login procedures ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Creating a MYSQL connection and database.
            Level 1
            Hello there.
            Yes, I believe that is what I mean.
            • 3. Re: Creating a MYSQL connection and database.
              Günter Schenk Level 4
              Hi Alyssa,

              please copy & paste the following SQL code in (assumingly) your PhpMyAdmin´s "SQL" field -- it will create a "login" and a "login_stats" table in your site´s database, and these tables will provide the required fields which you can instantly use for setting up your site´s login in ADDT´s Control Panel:

              -------
              CREATE TABLE `login` (
              `id` int(3) unsigned NOT NULL auto_increment,
              `username` varchar(30) NOT NULL default '',
              `realname` varchar(90) NOT NULL default '',
              `nickname` varchar(50) default NULL,
              `password` varchar(150) NOT NULL default '',
              `email` varchar(150) NOT NULL default '',
              `level` int(2) NOT NULL default '0',
              `random_key` varchar(200) default NULL,
              `login_attempts` smallint(6) NOT NULL default '0',
              `disable_date` datetime NOT NULL default '0000-00-00 00:00:00',
              `registration_date` datetime NOT NULL default '0000-00-00 00:00:00',
              `expiration` int(11) NOT NULL default '100',
              `active` tinyint(4) NOT NULL default '1',
              PRIMARY KEY (`id`)
              ) TYPE=MyISAM AUTO_INCREMENT=1 ;

              CREATE TABLE `login_stats` (
              `id_log` int(11) NOT NULL auto_increment,
              `id` int(11) NOT NULL default '0',
              `ip_log` varchar(15) NOT NULL default '',
              `datein_log` datetime NOT NULL default '0000-00-00 00:00:00',
              `dateout_log` datetime default NULL,
              `session_log` varchar(255) NOT NULL default '',
              PRIMARY KEY (`id_log`)
              ) TYPE=MyISAM AUTO_INCREMENT=1 ;
              -------

              In regards to your "I need to create a MYSQL connection" question -- please see the tutorial "Setting up a PHP development environment for Dreamweaver" in the Adobe Dreamweaver Developer Center :: http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php.html

              Now I don´t know if you already did setup a local testing server, however the tutorial´s last chapter will explain how to create a connection to your MySQL database -- what´s the first thing you´ll need to do before defining your site´s login settings in ADDT´s Control Panel

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Creating a MYSQL connection and database.
                Level 1
                Alright, I pasted that in there and it worked.
                What do I do next, after I paste it there?
                • 5. Re: Creating a MYSQL connection and database.
                  Günter Schenk Level 4
                  --
                  What do I do next, after I paste it there?
                  --

                  be happy it worked and go celebrate that, lol :-)

                  if you also managed to create a connection, just create an empty PHP file in whatever directory of your site you´d like to have the user login files reside in, and once this file is saved in the desired directory, click the "Control Panel" icon in the "Developer Toolbox" panel.

                  This Control Panel will let you define several site settings, and one of them is called "Login settings". When clicking the Key icon, things will get a little more complicated in the next window -- but fortunately it provides a "Help" button which will launch the ADDT help file which guides you through the steps.

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver

                  P.S. I will now be snoozing a little, as I´m in Germany -- however, just post your questions, I´ll read them later, ok ?
                  • 6. Re: Creating a MYSQL connection and database.
                    Level 1
                    lol. Yes, it did work. =]
                    Although, I have a question.
                    So it worked. So then I went to Dreamweaver, and set up the connection. Which worked. But now I'm trying to continue along with the log in thing. I'm setting up the log in settings, and I clicked the Database tag. My connection worked, but now it's telling me there's no table found and it wont let me click okay because of this.
                    And by the way, thank you so much for the help so far. I've been stuck on how to do this for over a week, so it means a lot to me that you're helping me.

                    P.S. ;; Woah, Germany. I live in Florida.
                    Well have a good sleep.
                    Reply to me when you can.
                    • 7. Re: Creating a MYSQL connection and database.
                      Günter Schenk Level 4
                      Good morning Alyssa :-)

                      At times you will have to "argue" DW into recognizing new tables which you probably created while DW was running -- please try this:

                      1. open the "Application" panel and click either on the "Databases" or the "Bindings" tab

                      2. on the very right you´ll see a blue "circle" icon -- this one will refresh the currently displayed connections & tables, means it will connect to your DB and retrieve any added/updated tables.

                      does this make it any better now ?

                      Cheers,
                      Günter Schenk
                      Adobe Community Expert, Dreamweaver
                      • 8. Re: Creating a MYSQL connection and database.
                        Level 1
                        No, it does not. I'm sorry. Hah.
                        I think I've discovered the problem.
                        Or, a problem. Or truthfully I'm not even sure if it affects anything at all, lol. But. When I go under Application to Database, as you said, I see my connection. I right-clicked it, and clicked Test Connection. And an error comes up that says ;;
                        "HTTP Error Code 404 File Not Found. Here are some possible reasons for the problem:

                        1) There is no testing server running on the server machine.
                        2) The testing server specified for this site does not map to the http://localhost/_mmServerScrips/MMHTTPDB.php URL. Verify that the URL Prefix maps to the root of the site."

                        Do you have any idea what I should do to make this work?
                        • 9. Re: Creating a MYSQL connection and database.
                          Günter Schenk Level 4
                          Well, I´m sure that your server is running, so 1) shouldn´t be causing the problem. That said, I reckon it´s indeed 2), so please check if the URL Prefix really matches your site root or not -- BTW, many folks actually stumble across that.

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver
                          • 10. Re: Creating a MYSQL connection and database.
                            Level 1
                            How would I check if the URL Prefix matches?
                            • 11. Re: Creating a MYSQL connection and database.
                              Günter Schenk Level 4
                              Please see...

                              1. Menu "Site" :: "Manage Sites" :: "Edit" (your site)

                              2. Select the "Testing Server" category

                              3. what did you see in the "Testing Server folder" and in the "URL prefix" input fields ?

                              Cheers,
                              Günter Schenk
                              Adobe Community Expert, Dreamweaver
                              • 12. Re: Creating a MYSQL connection and database.
                                Level 1
                                In the Testing Server folder, it says "C:\wamp\www\Unnamed Site 2\_mmServerScripts\"
                                And in the URL prefix it says "http://localhost/"
                                • 13. Re: Creating a MYSQL connection and database.
                                  Günter Schenk Level 4
                                  Oh well, there we have it :-)

                                  1. Please rename your "Unnamed Site 2" to something meaningful -- that´s just Dreamweaver´s initial dummy entry which *has* to be replaced by you to make sense -- that BTW wouldn´t have happened if you had given your DW site a meaningful "Site name" within the "Local info" category right from the start.

                                  Apart from that, it seems you didn´t really choose the "Testing Server Folder" by clicking on the folder icon to the right and navigate to the folder where your site is actually meant to reside in. Do you have a folder below "www/" named "Unnamed Site 2" ? Probably not -- at this point it will have to be the real folder name.

                                  2. after correctly setting the folder name as described above, your URL prefix will have to match that; example:

                                  http://localhost/foldername/

                                  Better now ?

                                  Cheers,
                                  Günter Schenk
                                  Adobe Community Expert, Dreamweaver
                                  • 14. Re: Creating a MYSQL connection and database.
                                    Level 1
                                    I feel like I completely messed something up.
                                    Should I start over and make a whole new site? And name it correctly this time? Hah.
                                    • 15. Re: Creating a MYSQL connection and database.
                                      Günter Schenk Level 4
                                      ------
                                      Should I start over and make a whole new site?
                                      ------

                                      yes, that might be the best decision at this -- though it could be fixed.

                                      ------
                                      And name it correctly this time?
                                      ------

                                      Oh yes, pleeease, lol :-)

                                      ------
                                      Hah
                                      ------

                                      sigh :-)

                                      Here´s a good read for you :: "Define a PHP site in Dreamweaver" :: http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.html

                                      Cheers,
                                      Günter Schenk
                                      Adobe Community Expert, Dreamweaver
                                      • 16. Re: Creating a MYSQL connection and database.
                                        Level 1
                                        lol.

                                        I feel like I don't know what I'm doing now.
                                        Can you like walk me through how to create a site? Haha, I feel pathetic for asking this, but still.
                                        As well as, can you walk me through how to create a log in?
                                        • 17. Re: Creating a MYSQL connection and database.
                                          Level 1
                                          Actually I take back what I just asked, lol.
                                          I just set up a site. So then, I went to click the thing that makes the log in, and a box popped up that says Setup Instructions. The first two are checked off, but the third one says "Set Up The Sites Testing Server" and it is not checked off. So I click it, and I'm not exactly sure what to do here.
                                          • 18. Re: Creating a MYSQL connection and database.
                                            Level 1
                                            Hello there again. How are you?
                                            I haven't spoken to you in a while.
                                            When you get the chance, would you possibly answer my other question?

                                            Why thank you. =]
                                            • 19. Re: Creating a MYSQL connection and database.
                                              Günter Schenk Level 4
                                              Hi Alyssa,

                                              ----
                                              How are you?
                                              ----

                                              very busy :-)

                                              ------
                                              So I click it, and I'm not exactly sure what to do here
                                              ------

                                              1. Server Model: Php_MySQL

                                              2. Access: Local/Network

                                              3. Testing Server Folder: click on the folder icon to the right and navigate to the root directory of your local site -- more precisely, click *inside* the root directory, Confirm with Save.

                                              What do you see now in the "Testing Server Folder" input ?

                                              However, all that stuff you´re having trouble with is well explained in the DW help (F 1) as well, please read "Working with Dreamweaver sites", subchapter: "Setting up a Dreamweaver site"

                                              ------
                                              Why thank you. =]
                                              ------

                                              No clue, lol :-)

                                              Cheers,
                                              Günter Schenk
                                              Adobe Community Expert, Dreamweaver
                                              • 20. Re: Creating a MYSQL connection and database.
                                                Level 1
                                                Ah, business. Sucks. D<<br />
                                                Anywhoo.

                                                In the Testing Server section, once I've done what you said, it says "C:\wamp\www\This\"
                                                • 21. Re: Creating a MYSQL connection and database.
                                                  Günter Schenk Level 4
                                                  OK,

                                                  if "This" is in fact your local site´s root folder, the URL prefix will have to be:

                                                  http://localhost/This/

                                                  to match that.

                                                  Cheers,
                                                  Günter Schenk
                                                  Adobe Community Expert, Dreamweaver
                                                  • 22. Re: Creating a MYSQL connection and database.
                                                    Level 1
                                                    I did that, and it's still not working.
                                                    • 23. Re: Creating a MYSQL connection and database.
                                                      Günter Schenk Level 4
                                                      ----
                                                      I did that, and it's still not working
                                                      ----

                                                      Humm, that´s weird.

                                                      I´ll be sending you a private email and asking you for a screenshot -- at this point I simply need more information.

                                                      Cheers,
                                                      Günter Schenk
                                                      Adobe Community Expert, Dreamweaver