<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>csTechie &#187; PHP Snippets</title>
	<atom:link href="http://cstechie.com/category/snippets/php-snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://cstechie.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 02 May 2010 16:05:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Snippet: Iterating through an array</title>
		<link>http://cstechie.com/php-snippet-iterating-through-an-array/</link>
		<comments>http://cstechie.com/php-snippet-iterating-through-an-array/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 15:52:38 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[PHP Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=194</guid>
		<description><![CDATA[


$colorList = array(0 =>"red",1=>"green",2=>"blue",3=>"black",4=>"white");

foreach( $colorList as $key => $value){
	      echo "Key: $key, Val: $value ";
}


OUTPUT:

Key: 0, Val: red
Key: 1, Val: green
Key: 2, Val: blue
Key: 3, Val: black
Key: 4, Val: white

]]></description>
			<content:encoded><![CDATA[<p><code></p>
<pre>

$colorList = array(0 =>"red",1=>"green",2=>"blue",3=>"black",4=>"white");

foreach( $colorList as $key => $value){
	      echo "Key: $key, Val: $value ";
}
</pre>
<p></code></p>
<p>OUTPUT:</p>
<pre>
Key: 0, Val: red
Key: 1, Val: green
Key: 2, Val: blue
Key: 3, Val: black
Key: 4, Val: white
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/php-snippet-iterating-through-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Snippet: PHP MySQL Database Sample Code</title>
		<link>http://cstechie.com/php-snippet-php-mysql-database-sample-code/</link>
		<comments>http://cstechie.com/php-snippet-php-mysql-database-sample-code/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 17:43:45 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[PHP Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=183</guid>
		<description><![CDATA[&#60;?php
//Connect to Databse
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db($G['dbname']);
?&#62;
&#60;?php
// Simple query returning a single row 'COL_VAL'
$query = &#34; SELECT 'COL_VAL' as COL_VAL &#34;;
//Fetch Result
$result  = mysql_query($query) or die('Error2, query failed:'.$query);
//Iterate through Result
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
	$C_COL_VAL = $row['COL_VAL'];
	echo &#34;$C_COL_VAL&#34;;
}
?&#62;
&#60;?php
//Closing DB Connection
mysql_close($conn);
?&#62;
]]></description>
			<content:encoded><![CDATA[<p><code>&lt;?php<br />
//Connect to Databse<br />
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');<br />
mysql_select_db($G['dbname']);<br />
?&gt;<br />
&lt;?php<br />
// Simple query returning a single row 'COL_VAL'<br />
$query = &quot; SELECT 'COL_VAL' as COL_VAL &quot;;<br />
//Fetch Result<br />
$result  = mysql_query($query) or die('Error2, query failed:'.$query);<br />
//Iterate through Result<br />
while($row = mysql_fetch_array($result, MYSQL_ASSOC))<br />
{<br />
	$C_COL_VAL = $row['COL_VAL'];<br />
	echo &quot;$C_COL_VAL&quot;;<br />
}<br />
?&gt;<br />
&lt;?php<br />
//Closing DB Connection<br />
mysql_close($conn);<br />
?&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/php-snippet-php-mysql-database-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Snippet: Print an array</title>
		<link>http://cstechie.com/php-snippet-print-an-array/</link>
		<comments>http://cstechie.com/php-snippet-print-an-array/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 17:04:18 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[PHP Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=175</guid>
		<description><![CDATA[

$mappings = array ('windows' => 'microsoft', 'ipod' => 'apple', 'corby' => 'samsum');
print_r($mappings);


output:


Array ( [windows] => microsoft [ipod] => apple [corby] => samsum )


]]></description>
			<content:encoded><![CDATA[<p><code>
<pre>
$mappings = array ('windows' => 'microsoft', 'ipod' => 'apple', 'corby' => 'samsum');
print_r($mappings);
</pre>
<p></code></p>
<p>output:<br />
<code>
<pre>
Array ( [windows] => microsoft [ipod] => apple [corby] => samsum )
</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/php-snippet-print-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sample Code: Simple Form Processing in PHP</title>
		<link>http://cstechie.com/sample-code-simple-form-processing-in-php/</link>
		<comments>http://cstechie.com/sample-code-simple-form-processing-in-php/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 14:18:22 +0000</pubDate>
		<dc:creator>syam</dc:creator>
				<category><![CDATA[PHP Snippets]]></category>

		<guid isPermaLink="false">http://cstechie.com/?p=143</guid>
		<description><![CDATA[
&#60;?php

 if(isset($_POST['submit'])){
    echo $_POST['name'];
 }else{

?&#62;
&#60;html&#62;
&#60;body&#62;
  &#60;form method=&#34;post&#34; action=&#34;&#34;&#62;
    &#60;input name=&#34;name&#34; id=&#34;name&#34; type=&#34;text&#34; /&#62;
	&#60;input name=&#34;submit&#34; id=&#34;submit&#34; value=&#34;Add Me&#34; type=&#34;submit&#34; /&#62;
  &#60;/form&#62;
&#60;/body&#62;
&#60;/html&#62;
&#60;?php
}
?&#62;

]]></description>
			<content:encoded><![CDATA[<pre>
&lt;?php

 if(isset($_POST['submit'])){
    echo $_POST['name'];
 }else{

?&gt;
&lt;html&gt;
&lt;body&gt;
  &lt;form method=&quot;post&quot; action=&quot;&quot;&gt;
    &lt;input name=&quot;name&quot; id=&quot;name&quot; type=&quot;text&quot; /&gt;
	&lt;input name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;Add Me&quot; type=&quot;submit&quot; /&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cstechie.com/sample-code-simple-form-processing-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
