Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion Video
internet.com

» HOME
» NEWS
» VIDEO
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner


















Microsoft Issues Warnings on IE 8 Beta 2

Comcast Pushes Ahead on Broadband Throttling

The Microsoft-Novell Deal and Trust in Princes

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers



Related Articles
Build Your Own Database Driven Website Using PHP & MySQL: Pt. 2
Build Your Own Database Driven Website Using PHP & MySQL: Pt. 3
Build Your Own Database Driven Website Using PHP & MySQL: Pt. 4

Senior Software Developer
Professional Technical Resources
US-CA-Santa Clara

Justtechjobs.com Post A Job | Post A Resume
MySQL
January 3, 2002
Build Your Own Database Driven Website Using PHP & MySQL: Pt. 1
By Kevin Yank

It would be unfair of me to help you get everything installed and not even give you a taste of what a PHP-driven Web page looks like until Part 3, so here's a little something to whet your appetite.

Open up your favorite text or HTML editor and create a new file called today.php. Note that, to save a file with a .php extension in Notepad, you'll need to either select 'All Files' as the file type, or surround the filename with quotes in the Save As dialog; otherwise, Notepad will helpfully save the file as today.php.txt. Type this into the file:

<html>
<head>
<title>Today's Date</title>
</head>
<body>
<p>Today's Date 
(according to this 
  Web server) is
<?php

  echo( date("l, F dS Y.") );

?></p>
</body>
</html>

If you prefer, you can download this file along with the rest of the code in this article series here.

Save this and place it on your Web site as you would any regular HTML file, then view it in your browser. Note that if you view the file on your own machine, you cannot use the File, Open feature of your browser, because your Web server must intervene to interpret the PHP code in the file. Instead, you must move the file into the document root folder of your Web server software (e.g. C:\inetpub\wwwroot\ in IIS, or C:\Apache Group\Apache\htdocs\ in Apache for Windows), then load it into your browser by typing http://localhost/today.php. This allows the Web server to run the PHP code in the file and replace it with the date before it's sent to the Web browser. If you haven't yet had time to set up PHP on your Web server, click here to see the results on our server.

Pretty neat, huh? If you use the ‘View Source' feature in your browser, all you'll see is a regular HTML file with the date in it. The PHP code (everything between <?php and ?> in the code above) has been interpreted by the Web server and converted to normal text before it's sent to your browser. The beauty of PHP (and other server-side scripting languages) is that the Web browser doesn't have to know anything about it – the Web server does all the work!

And don't worry too much about the exact code I used in this example. Before too long you'll know it like the back of your hand.

If you don't see the date, then something is wrong with the PHP support in your Web server. Use View Source in your browser to look at the code of the page. You'll probably see the PHP code there in the page. Since the browser doesn't understand PHP, it just sees <?php ... ?> as one long, invalid HTML tag, which it ignores. Make sure that PHP support has been properly installed on your Web server, either in accordance with the instructions provided in previous sections of this article, or by your Web host.

Summary

You should now have everything you need to get MySQL and PHP installed on your Web Server. If the little example above didn't work right (for example, if the raw PHP code appeared instead of the date), something went wrong with your setup procedure. Drop by the SitePoint.com Forums and we'll be glad to help you figure out the problem!

In Part 2, you'll learn the basics of relational databases and get started working with MySQL. If you've never even touched a database before, I promise you it'll be a real eye opener! Meanwhile, I'd love to hear what you thought of the first part of this series of articles. Drop me a line at kevin@sitepoint.com, or stop by the SitePoint.com Forums to speak your mind.

Go to page: Prev  1  2  3  4  5  6  7  8  9  10  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

MySQL Archives







Latest Forum Threads
MySQL Forum
Topic By Replies Updated
database survey... the old link was wrong broken16 0 August 22nd, 10:04 AM
db design or query alipark 0 August 21st, 06:59 AM
database survey: MySQL and Oracle broken16 0 August 18th, 01:45 AM
Sql Server 2005 - Time Difference travimca 0 August 11th, 12:26 AM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES