Database Reference
In-Depth Information
The Eclipse Integrated Development Environment (IDE)
Although a simple text editor such as Microsoft Notepad is fine for simple Web pages, as we
start creating more complex pages, we will move to an integrated development environ-
ment (IDE) . An IDE is intended to be a complete development framework, with all the tools
you need in one place. An IDE gives you the most robust and user-friendly means of creating
and maintaining your Web pages.
If you are working with Microsoft products, you will most likely use Visual Studio (or ei-
ther the Visual Studio 2012 Express Editions, available for free from http://www.microsoft.com/
visualstudio/eng/products/visual-studio-express-products ) . In fact, if you have installed SQL
Server 2012 Express Advanced or any non-Express version of the product, you have already
installed some Visual Studio components. These are installed to support SQL Server Reporting
Services, and they are sufficient for creating basic Web pages. If you are working with
JavaScript or Java, you might prefer the NetBeans IDE (downloadable from www.netbeans.org ) .
For this chapter, we will again turn to the open-source development community and use the
Eclipse IDE . Eclipse provides a framework that can be modified by add-in modules for many pur-
poses. For PHP, we can use Eclipse as modified for the Eclipse PDT (PHP Development Tools)
Project , which is specifically intended to provide a PHP development environment in Eclipse (see
http://projects.eclipse.org/projects/tools.pdt for general information and http://www.eclipse.org/pdt/
downloads/ for downloadable files—download the current stable build for your operating system). 5
Figure 11-30 shows the index.html file as created in the Eclipse IDE. Compare this version
with the Notepad version in Figure 11-29.
The ReadArtist.php File
Now that we have our basic Web site set up, we will start to integrate PHP into the Web pages.
First, we will create a page to read data from a database table and display the results in a Web page.
Specifically, we will create a Web page in the VRG folder named ReadArtist.php to run the SQL query:
SELECT LastName, FirstName, Nationality FROM ARTIST;
This page displays the result of the query, without the table's surrogate key of ArtistID, in a
Web page. The HTML and PHP code for ReadArtist.php is shown in Figure 11-31, and the same
code is shown in Eclipse in Figure 11-32.
The DBP-e13-VRG
project—Eclipse
organizes work into
projects
The index.html HTML
code—note how color
coding has been
added to indentation
to keep the code
organized and
readable
Figure 11-30
the HtML Code for the
index.html File in the Eclipse
IDE
5 As noted on the PDT download page, you also need to install the Java Runtime Environment (as of this writing, it is
JRE 7 Update 21 from Sun Microsystems, at http://www.oracle.com/technetwork/java/javase/downloads/index.html ) .
Also note that the Windows version of Eclipse does not install like most Windows program: You need to create a folder
named Eclipse in the Program Files folder on your C: drive (the full path name will be C:\Program Files\Eclipse), unzip
the Eclipse PDT files in that directory, and create a desktop shortcut to Eclipse.exe. See Appendix I for more details.
 
Search WWH ::




Custom Search