Viewers: in countries Watching now:
Join author David Gassner as he describes how to add dynamic data to a PHP-enabled web site in Adobe Dreamweaver. This intermediate course shows how to plan and create a MySQL database, define a PHP-enabled site in Dreamweaver, connect the site to the database, and manage and present dynamic data. David also explores Dreamweaver features such as PHP custom class introspection and site-specific code hinting as well as the differences between the CS5 and CS6 versions of the software.
This course was updated on 6/12/2012.
In a previous video, I showed how to display data using a repeating region. There's another approach, which is to generate a dynamic HTML table. For this demonstration, I'll use a file named explorerlist.php, which you'll find in the Explorers folder of the current site. This file doesn't currently have any record sets, so I'll add one. It doesn't matter where the cursor is if you're looking at it in Code view, all of the code for the recordset will always go at the top of the page with a little bit of PHP code at the end.
With the page open, I'll go to the Bindings panel and click the plus button and choose Recordset query. Make sure you're in the simple version of the Recordset builder. I'll name my new recordset rsExplorers. The Connection should be set to explorecalifornia, and the Table to explorers. I'll click the Selected radio button, hold down the Ctrl key on Windows or the Command key on Mac, and choose explorerId, firstName, lastName, dob and email.
I'll test my recordset and see that it comes back in numeric order by primary key, but I'd really like it in order by lastName. So I'll click OK, and then change the Sort to lastName, and I'll test again. And now it's coming back in lastName alphabetical order. I'll click OK and click OK to insert the recordset into my page. Now I'm ready to insert the dynamic table. I'm still in Code view.
I'll scroll down the page until I find where I want to place the table. There is an h1 tag set that currently is at line 71 in my version of the file. I'll place the cursor after the heading1 tags and then add in a paragraph tag set by pressing Ctrl+Shift+P on Windows or Command+Shift+P on Mac. The Dynamic Table tool really only works well when you're in Design view, so I'm going to leave the cursor in that exact location, and then go to Design view and then I'll insert the dynamic table.
You can do this from the menu by choosing Insert > Data Objects > Dynamic Data > Dynamic Table. There's also an option in the Insert panel. I'll use this menu choice, and in the Dynamic Table tool dialog, I'll verify that the rsExplorers recordset is selected, it's the only one in this page, and then I'll choose All records. I'll set the Border to 0 and leave the Cell padding and Cell spacing alone. These are values that I'll prefer to set later using cascading style sheets, and then I'll click OK.
The dynamic table is added automatically in the exact location where I had my cursor. I'll save the changes by pressing Ctrl+S on Windows or Command+S on Mac and then I'll go up to Live View and copy the file over to the server, and here's the result. The data is retrieved from the server and displayed in a dynamic HTML table. I'll do a little bit of editing and formatting. I'll exit Live View, and first I'm going to delete the column that shows the primary key.
I'll click into the first cell in the column and then drag down to the second. I'll release the mouse button and press Delete. I'll change the headings; by default the heading show the exact column names. I'd like to show more friendly information, so I'll change the firstName column header to First Name, lastName to Last Name, dob to Birthdate and for email, I'll simply capitalize the first character, Email.
I'll also click in the first cell of the row and then drag to the last cell and release, then in the Properties panel I'll click Header, and that turns those into TD tags in the HTML. I'll save the changes, and then go to Live View again, copying the file to the testing server and I'll see that my dynamic table is now much more friendly and easy to look at.
Find answers to the most frequently asked questions about Dreamweaver with PHP and MySQL .
Here are the FAQs that matched your search "" :
<?php include('../ZendFramework/library/Zend/Date.php'); ?
<?php echo $_SERVER['DOCUMENT_ROOT']; ?
You can then programmatically modify the include_path variable at runtime with the set_include_path() function. For example, if your physical root folder is /home/myroot, the code might look like this:
<?phpset_include_path('.' . PATH_SEPARATOR .'/home/myroot/ZendFramework/library/Zend');include('Date.php');?
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.