How to setup a web development environment

Welcome to our first video tutorial. Where I’m going to show you in detail how to setup a local web development environment. This tutorial is for novices and beginner in web development. Most of us are using Windows systems, this is because I selected WAMP at the most appropriate tool for us. We will install WAMP at our computer, and I will show you how you can use your database (phpMyAdmin), and, as some extra – I will show you a process of making own php-based RSS feed (on PHP).

After you have finished this video, you can copy and test the code we have just made:

01 <?
02 // step 1 - we should connect to database and take all our records:
03 $vLink = mysql_connect('localhost''root'''); // this is default username and password for WAMP
04 mysql_select_db('test_db'$vLink);
05 mysql_query('SET names UTF8'); // let's set UTF8 mode (in order to support unicode)
06 $sSQL 'SELECT * FROM `stories` ORDER BY `id` DESC'// this is our SQL query to take our records
07 $vRes = mysql_query($sSQL); // execution of query
08 $aStories array(); // an empty array to collect stories (records)
09 if ($vRes) {
10     while($aRow = mysql_fetch_array($vRes, MYSQL_ASSOC)) { // lets walk through all the records
11         $aStories[] = $aRow;
12     }
13     mysql_free_result($vRes);
14 }
15 // check
16 // print_r($aStories); // well done
17 // step 2 - display data array as rss feed
18 $sFeeds '';
19 foreach ($aStories as $aStory) { // let's walk through all the records again and prepare Items for RSS
20     $sFeeds .= <<<EOF
21 <item>
22     <guid><![CDATA[{$aStory['id']}]]></guid>
23     <link><![CDATA[story.php?id={$aStory['id']}]]></link>
24     <title><![CDATA[{$aStory['title']}]]></title>
25     <description><![CDATA[{$aStory['description']}]]></description>
26     <pubDate>{$aStory['when']}</pubDate>
27 </item>
28 EOF;
29 }
30 // now - we should prepare necessary header and output our RSS feed:
31 header('Content-Type: text/xml; charset=utf-8');
32 echo <<<EOF
33 <?xml version="1.0" encoding="UTF-8" ?>
34 <rss version="2.0">
35     <channel>
36         <title>Our own RSS feed</title>
37         <link>http://localhost/feed.php</link>
38         <description>Our own RSS feed</description>
39         <lastBuildDate>2012-07-16 00:00:00</lastBuildDate>
40         {$sFeeds}
41     </channel>
42 </rss>
43 EOF;

download package