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

Appearances Are Everything - 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.

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Now, go back to the editor and decide how you want to display the data returned in the Recordset. I like to keep things simple, so I merely created a bulleted list of users,
<ul>
<li></li>
</ul>
and then dragged columns from the Recordset object in the "Application" panel to the appropriate place on the page where I'd like the data displayed (Dreamweaver wrote the code for me).
<ul>
<li><?php echo $row_Recordset1['username']; ?></li>
</ul>
And when you preview it in the browser, you should see something like this:



Cool, huh? I managed all that using simple point-and-click actions, with no requirement to know anything about PHP's MySQL API or remember complex function syntax.

Of course, the example's still somewhat incomplete - all it does is display the first record. What we really need is the entire recordset returned by the SQL query. In order to meet this and other requirements, Dreamweaver includes a variety of different "server behaviors", which can be used to add extra functionality to your application.

In order to see how this works, select the first item of your newly-created list in the editor,



pop open the "Server Behavior" tab of the "Application" panel, and select the "Repeat Region" behavior from the drop-down option list, and tell it to loop for as many times as there are records.





Dreamweaver will automatically insert PHP code that iterates over the returned Recordset object and print the entire set of records returned. Here's the code,
<ul>
<?php do { ?>
<li><?php echo $row_Recordset1['username']; 
?></li>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); 
?>
</ul>
and here's the output:



Dreamweaver comes with a whole bunch of other, similar behaviors to meet most common requirements - you can just as easily (for example) display the total number of records found, implement paging with next and previous links, or dynamically show sections of a page based on the current position of the recordset pointer.

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- 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: