top of page

interieurarchitecten groep

Openbaar·16 leden

Dreamweaver CC 2017 Database Tutorial: Learn How to Create and Manage MySQL Databases with PHP



How to Connect to a Database in Dreamweaver CC 2017




If you are a web developer who wants to create dynamic and interactive web applications, you might want to use Adobe Dreamweaver CC 2017 as your web development tool. Dreamweaver CC 2017 is a powerful and versatile software that allows you to design, code, and publish websites and web applications using HTML, CSS, JavaScript, PHP, and other web technologies.




Dreamweaver cc 2017 database



One of the essential features of web applications is the ability to store, retrieve, and manipulate data from a database. A database is a collection of organized data that can be accessed by a web server using a programming language such as PHP. By connecting to a database in Dreamweaver CC 2017, you can create web pages that display dynamic data from the database, as well as perform operations such as inserting, updating, deleting, and searching data.


In this article, you will learn how to connect to a MySQL database in Dreamweaver CC 2017 using PHP as the server-side scripting language. You will also learn how to use the database, bindings, and server behaviors panels in Dreamweaver CC 2017 to create web pages that interact with the database. By the end of this article, you will be able to create your own web applications that use a database in Dreamweaver CC 2017.


Prerequisites




Before you can connect to a database in Dreamweaver CC 2017, you need to have the following:


  • A web server with PHP support. You can use a local web server such as XAMPP or WAMP on your computer, or a remote web server that hosts your website.



  • A MySQL database server. You can use a local MySQL server such as XAMPP or WAMP on your computer, or a remote MySQL server that hosts your database.



  • A database user account with appropriate privileges. You need to have a username and password that can access the MySQL server and perform operations on the database.



  • A database name and table structure. You need to have a database name that identifies your database on the MySQL server, and a table structure that defines the columns and rows of your data.



  • Dreamweaver CC 2017 installed on your computer. You can download and install Dreamweaver CC 2017 from Adobe's website.



Steps to Connect to a Database in Dreamweaver CC 2017




To connect to a database in Dreamweaver CC 2017, you need to follow these steps:


How to enable server behaviors and data bindings panel support in Dreamweaver CC 2017




One of the first things you need to do is to enable the server behaviors and data bindings panel support in Dreamweaver CC 2017. These panels are essential for connecting to a database and creating dynamic web pages. However, they are not enabled by default in Dreamweaver CC 2017, so you need to install an extension that adds them to the software.


To enable the server behaviors and data bindings panel support in Dreamweaver CC 2017, you need to do the following:


  • Download the Server Behaviors & Database Extension from Adobe's website.



  • Open Dreamweaver CC 2017 and go to Help > Manage Extensions.



  • In the Adobe Extension Manager CC window, click on the Install button and browse to the location where you saved the extension file.



  • Follow the instructions on the screen to install the extension.



  • Restart Dreamweaver CC 2017 and check if the Database, Bindings, and Server Behaviors panels are available under the Window > Server Behaviors menu.



How to create a site definition and a testing server in Dreamweaver CC 2017




The next step is to create a site definition and a testing server in Dreamweaver CC 2017. A site definition is a set of settings that tells Dreamweaver how to manage your website files and folders. A testing server is a web server that allows you to preview and test your web pages before publishing them online.


To create a site definition and a testing server in Dreamweaver CC 2017, you need to do the following:


  • In Dreamweaver CC 2017, go to Site > New Site.



  • In the New Site dialog box, enter a name for your site in the Site Name field, and browse to the location where you want to store your site files in the Local Site Folder field.



  • In the same dialog box, click on the Servers category on the left side, and then click on the Add New Server button on the right side.



  • In the New Server dialog box, enter a name for your server in the Name field, and choose PHP MySQL as the Server Model.



In the same dialog box, click on the BASIC tab, and enter the following information:


  • Connect using: Choose how you want to connect to your web server. If you are using a local web server such as XAMPP or WAMP, choose Local/Network. If you are using a remote web server that hosts your website, choose FTP, SFTP, or WebDAV, depending on your server configuration.



  • Server Folder: Browse to the location where you want to store your web pages on your web server. This should be a subfolder of your web server's root folder, such as /htdocs/your_site_name/.



  • Web URL: Enter the URL that corresponds to your server folder, such as .



  • If you are using FTP, SFTP, or WebDAV, enter your username and password for accessing your web server in the appropriate fields.



In the same dialog box, click on the AADVANCED tab, and enter the following information:


  • Maintain synchronization information: Check this option if you want Dreamweaver to keep track of changes made to your files and folders.



  • Cloaking: Check this option if you want Dreamweaver to hide certain files and folders from being uploaded or downloaded.



  • Caching:: Check this option if you want Dreamweaver to store a copy of your files and folders on your computer for faster access.



  • Testing Server: Check this option if you want to use this server as your testing server. A testing server is a web server that allows you to preview and test your web pages before publishing them online.



  • Server Model: Choose PHP MySQL as the server model. This tells Dreamweaver that you are using PHP as the server-side scripting language and MySQL as the database server.



  • Click on the Save button to save your server settings.



  • In the New Site dialog box, click on the Save button to save your site definition.



How to create a MySQL connection in Dreamweaver CC 2017




The next step is to create a MySQL connection in Dreamweaver CC 2017. A MySQL connection is a set of settings that tells Dreamweaver how to access your MySQL database server and perform operations on your database.


To create a MySQL connection in Dreamweaver CC 2017, you need to do the following:


  • In Dreamweaver CC 2017, go to Window > Server Behaviors.



  • In the Server Behaviors panel, click on the + button and choose MySQL Connection.



  • In the MySQL Connection dialog box, enter a name for your connection in the Connection Name field.



In the same dialog box, enter the following information:


  • MySQL Server: Enter the hostname or IP address of your MySQL server. If you are using a local MySQL server such as XAMPP or WAMP, enter localhost. If you are using a remote MySQL server that hosts your database, enter the domain name or IP address of your server.



  • User Name: Enter the username of your database user account that can access your MySQL server and perform operations on your database.



  • Password: Enter the password of your database user account that can access your MySQL server and perform operations on your database.



  • Database: Choose the name of your database from the drop-down list. If you don't see your database name, click on the Select button and refresh the list.



  • Click on the OK button to create your MySQL connection.



  • In the Server Behaviors panel, you should see your MySQL connection listed under the Data Sources category.



How to test the MySQL connection in Dreamweaver CC 2017




The next step is to test the MySQL connection in Dreamweaver CC 2017. Testing the MySQL connection allows you to verify that Dreamweaver can communicate with your MySQL server and access your database.


To test the MySQL connection in Dreamweaver CC 2017, you need to do the following:


  • In Dreamweaver CC 2017, go to Window > Server Behaviors.



  • In the Server Behaviors panel, right-click on your MySQL connection and choose Test Connection.



  • A new browser window will open and display a message that indicates whether the connection was successful or not. If the connection was successful, you should see a message like Connection was made and the database was found.. If the connection failed, you should see an error message that explains the reason for the failure.



  • Close the browser window and return to Dreamweaver CC 2017.



How to use the database, bindings, and server behaviors panels in Dreamweaver CC 2017




The final step is to use the database, bindings, and server behaviors panels in Dreamweaver CC 2017 to create web pages that interact with the database. These panels allow you to insert, update, delete, and display data from the database using server behaviors, bind data from the database to HTML elements using bindings, and use recordsets, repeat regions, dynamic tables, and other database features in Dreamweaver CC 2017.


To use the database, bindings, and server behaviors panels in Dreamweaver CC 2017, you need to do the following:


How to insert data into the database using server behaviors




To insert data into the database using server behaviors, you need to create a web page that contains a form with input fields that correspond to the columns of your database table. You also need to apply a server behavior that executes a SQL query that inserts the data from the form into the database table.


To insert data into the database using server behaviors, you need to do the following:


  • In Dreamweaver CC 2017, create a new web page and save it as insert.php in your site folder.



  • In the Design view of Dreamweaver CC 2017, insert a Form element from the Insert > Form menu.



  • In the same view, insert input fields such as Text Field, Password Field, Email Field, Radio Button, Checkbox, Select List, etc. from the Insert > Form menu. Make sure that each input field has a unique name attribute that matches the column name of your database table.



  • In the same view, insert a Submit Button element from the Insert > Form menu. Give it a value attribute such as Insert Data.



  • In Dreamweaver CC 2017, go to Window > Server Behaviors.



  • In the Server Behaviors panel, click on the + button and choose Insert Record.



  • In the Insert Record dialog box, choose your MySQL connection from the drop-down list.



  • In the same dialog box, choose your database table from the drop-down list.



  • In the same dialog box, map each column name of your database table to each form field name of your web page. You can do this by clicking on each column name and choosing the corresponding form field name from the drop-down list.



  • In the same dialog box, enter a URL for redirecting after inserting data in the A fter Inserting, Go To field. You can enter the URL of another web page that displays a confirmation message or the data inserted, such as success.php.



  • Click on the OK button to apply the server behavior.



  • In the Server Behaviors panel, you should see the Insert Record server behavior listed under the Server Behaviors category.



  • Save and upload your web page to your web server.



  • Open your web page in a browser and fill out the form with some data. Click on the Insert Data button and check if the data is inserted into the database table and if you are redirected to the URL you specified.



How to update data in the database using server behaviors




To update data in the database using server behaviors, you need to create a web page that contains a form with input fields that correspond to the columns of your database table. You also need to apply a server behavior that executes a SQL query that updates the data from the form into the database table based on a primary key value.


To update data in the database using server behaviors, you need to do the following:


  • In Dreamweaver CC 2017, create a new web page and save it as update.php in your site folder.



  • In the Design view of Dreamweaver CC 2017, insert a Form element from the Insert > Form menu.



  • In the same view, insert input fields such as Text Field, Password Field, Email Field, Radio Button, Checkbox, Select List, etc. from the Insert > Form menu. Make sure that each input field has a unique name attribute that matches the column name of your database table.



  • In the same view, insert a hidden input field from the Insert > Form > Hidden Field menu. Give it a name attribute such as id, and a value attribute that matches the primary key value of the record you want to update. For example, if your primary key column is called user_id, and you want to update the record with user_id = 1, then enter .



  • In the same view, insert a Submit Button element from the Insert > Form menu. Give it a value attribute such as Update Data.



  • In Dreamweaver CC 2017, go to Window > Server Behaviors.



  • In the Server Behaviors panel, click on the + button and choose Update Record.



  • In the Update Record dialog box, choose your MySQL connection from the drop-down list.



  • In the same dialog box, choose your database table from the drop-down list.



  • In the same dialog box, map each column name of your database table to each form field name of your web page. You can do this by clicking on each column name and choosing the corresponding form field name from the drop-down list.



  • In the same dialog box, enter the name of your hidden input field that contains the primary key value in the Key Column field. For example, if your hidden input field is called id, then enter id.



  • In the same dialog box, enter a URL for redirecting after updating data in the After Updating, Go To field. You can enter the URL of another web page that displays a confirmation message or the data updated, such as success.php.



  • Click on the OK button to apply the server behavior.



  • In the Server Behaviors panel, you should see the Update Record server behavior listed under the Server Behaviors category.



  • Save and upload your web page to your web server.



  • Open your web page in a browser and fill out the form with some data. Click on the Update Data button and check if the data is updated in the database table and if you are redirected to the URL you specified.



How to delete data from the database using server behaviors




To delete data from the database using server behaviors, you need to create a web page that contains a link or a button that triggers a SQL query that deletes a record from the database table based on a primary key value.


To delete data from the database using server behaviors, you need to do the following:


  • In Dreamweaver CC 2017, create a new web page and save it as delete.php in your site folder.



  • In the Design view of Dreamweaver CC 2017, insert a Link or a Button element from the Insert > Common menu.



  • In the same view, give your link or button a text or value attribute such as Delete Data.



  • In Dreamweaver CC 2017, go to Window > Server Behaviors.



  • In the Server Behaviors panel, click on the + button and choose Delete Record.



  • In the Delete Record dialog box, choose your MySQL connection from the drop-down list.



  • In the same dialog box, choose your database table from the drop-down list.



  • In the same dialog box, enter the name of the column that contains the primary key value in the Key Column field. For example, if your primary key column is called user_id, then enter user_id.



  • In the same dialog box, enter the value of the primary key of the record you want to delete in the Key Value field. For example, if you want to delete the record with user_id = 1, then enter 1.



  • In the same dialog box, enter a URL for redirecting after deleting data in the After Deleting, Go To field. You can enter the URL of another web page that displays a confirmation message or the data deleted, such as success.php.



  • Click on the OK button to apply the server behavior.



  • In the Server Behaviors panel, you should see the Delete Record server behavior listed under the Server Behaviors category.



  • Save and upload your web page to your web server.



  • Open your web page in a browser and click on the Delete Data link or button and check if the data is deleted from the database table and if you are redirected to the URL you specified.



How to display data from the database using server behaviors




To display data from the database using server behaviors, you need to create a web page that contains HTML elements that can display data from the database, such as text, images, links, tables, etc. You also need to apply a server behavior that executes a SQL query that selects data from the database table and binds it to the


  • Over

    Welkom bij de groep! Je kunt contact leggen met andere leden...

    bottom of page