Home arrow PHP arrow Page 8 - Building PHP Applications With Macromedia Dreamweaver MX

In And Out - PHP

Looking for a RAD tool to help you quickly and efficiently develop PHP-based Web applications? Or just new to PHP and MySQL in general? You might want to spend some time with Dreamweaver MX, Macromedia's latest revision of their venerable HTML editor, which comes with some nifty new ideas designed to minimize hand-coding of PHP scripts.

  1. Building PHP Applications With Macromedia Dreamweaver MX
  2. Hooking Up
  3. Test Drive
  4. Breaking Ground
  5. Naming Names
  6. Bringing In The Database
  7. Appearances Are Everything
  8. In And Out
  9. I, Robot
  10. Weaving The Web
By: Harish Kamath, (c) Melonfire
Rating: starstarstarstarstar / 32
December 18, 2002

print this article


OK, so that took care of displaying the records - now how about inserting and deleting records?

First, use the Dreamweaver editor to create an HTML form that maps to the columns of the "user" table.

Once the form has been prepared, apply the "Insert Record" server behavior, and you'll see a dialog box like this:

This dialog box makes it very easy to map form fields to the table in which data is to be inserted. Once you select the appropriate database connection and table, the fields of the table are displayed; these fields can be mapped to specific fields in the form via the "Value" drop-down list. Dreamweaver takes care of writing the SQL query needed to insert the data entered by the user in each field into the appropriate column in the table.

After you've finished mapping form fields to table columns, remember to specify the URL to which the browser should be redirected once the data has been successfully inserted into the database.

Once you're done, save the PHP script and access it via your browser. You should see the HTML form you created:

Enter some values and submit the form. The code generated by Dreamweaver MX will insert the values into the "user" table and then redirect the browser to the URL selected...all without the developer writing a single line of code!

It's just as simple to delete records - create a new PHP script and use the "Delete Record" server behavior. You'll see the following dialog box, which asks you to specify the variables that the script should use when identifying which record to delete.

As you can see, in the example above, I've told Dreamweaver to look for the "id" variable in the URL string, and to delete the record corresponding to that ID in the "user" table. Save the script (I'll assume it's called "delete.php"), and access it via your browser (remember to add the "id" variable-value pair to the URL string, like thus: http://your.server/delete.php?id=15), and the record corresponding to the ID provided should get deleted from the database.

Obviously, it's pretty easy to now link the three scripts above with each other, so as to build a primitive, yet fully-functional, user administration module (in case you're wondering, yes, Dreamweaver also comes with an "Update Record" behavior - I'll leave that to you to experiment with.)

>>> More PHP Articles          >>> More By Harish Kamath, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: