<?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>The Tech Space</title>
	<atom:link href="http://www.thetechspace.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thetechspace.com</link>
	<description>php, jquery, flash and resources</description>
	<lastBuildDate>Thu, 23 Feb 2012 06:14:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=172</generator>
		<item>
		<title>How to use separated sessions based on application in symfony</title>
		<link>http://www.thetechspace.com/2012/02/23/how-to-use-separated-sessions-based-on-application-in-symfony/</link>
		<comments>http://www.thetechspace.com/2012/02/23/how-to-use-separated-sessions-based-on-application-in-symfony/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 06:14:00 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=373</guid>
		<description><![CDATA[Currently, I&#8217;m playing with symfony mvc framework. In my current project is developing used by symfony and that&#8217;s have 2 app which are backend and frontend. But the project requirement is &#8211; these apps have to use their own session. So I separated the session in application level configuration as like follow - In apps/backend/config/factories.yml [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Currently, I&#8217;m playing with symfony mvc framework. In my current project is developing used by symfony and that&#8217;s have 2 app which are backend and frontend. But the project requirement is &#8211; these apps have to use their own session. So I separated the session in application level configuration as like follow -</p>
<p>In apps/backend/config/factories.yml</p>
<pre class="brush:yaml">#apps/backend/config/factories.yml

all:

  ... # other configurations

  storage:
    class: sfSessionStorage
    param:
      session_name: backend_session</pre>
<p>In apps/frontend/config/factories.yml</p>
<pre class="brush:yml">#apps/frontend/config/factories.yml

all:

  ... # other configurations

  storage:
    class: sfSessionStorage
    param:
      session_name: frontend_session</pre>
<p>That all it is. Hope it useful for someone</p>
<div class="shr-publisher-373"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2012/02/23/how-to-use-separated-sessions-based-on-application-in-symfony/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reCAPTCHA plugin for php codeigniter</title>
		<link>http://www.thetechspace.com/2011/03/04/recaptcha-plugin-for-php-codeigniter/</link>
		<comments>http://www.thetechspace.com/2011/03/04/recaptcha-plugin-for-php-codeigniter/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 07:55:14 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[reCAPTCHA]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=350</guid>
		<description><![CDATA[I&#8217;m playing around with codeigniter frameworks these days. One of my client requested to put reCAPTCHA into CI frameworks. So, I have tried to convert from original reCAPTCHA php plug-in to codeigniter library. So, I would like to share this library. I hope it useful for someone. To use this library, you just need to [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I&#8217;m playing around with codeigniter frameworks these days. One of my client requested to put reCAPTCHA into CI frameworks. So, I have tried to convert from original reCAPTCHA php plug-in to codeigniter library. So, I would like to share this library. I hope it useful for someone.</p>
<p>To use this library, you just need to follow by under following instruction :</p>
<p>Firstly, you have to move Recaptcha.php file into CI file structure system/application/libraries/<br />
Use following code to load that library -</p>
<pre class="brush:php">
$this-&gt;load-&gt;library('recaptcha');
</pre>
<p>Then you have to set keys. Sometime you just need to set only one public key. So, just set public key only.<br />
To set the keys</p>
<pre class="brush:php">
// Get a key from https://www.google.com/recaptcha/admin/create
$this-&gt;recaptcha-&gt;set_key ('XXXXXXXXXX Key XXXXXXXXX' ,'public') // For public key
$this-&gt;recaptcha-&gt;set_key ('XXXXXXXXXX Key XXXXXXXXX' ,'private') // For private key
</pre>
<p><span id="more-350"></span><br />
To Show reCAPTCHA image and from. You just simply need to call recaptcha_get_html () function. In that function you can define theme and language of reCAPTCHA (<a href="http://code.google.com/apis/recaptcha/docs/customization.html">Customization</a>).<br />
The function builded like -</p>
<pre class="brush:php">
recaptcha_get_html ( $error = null, $use_ssl = false, $options = array ('theme' => 'red', 'lang' => 'en') )
</pre>
<p>You just simply need to call like -</p>
<pre class="brush:php">
//Options for themes and language
$options = array ('theme' =&gt; 'clean', 'lang' =&gt; 'fr') ;
echo $this-&gt;recaptcha-&gt;recaptcha_get_html ( '', false, $options )
</pre>
<p>To check the answer from client</p>
<pre class="brush:php">
$resp = $this-&gt;recaptcha-&gt;recaptcha_check_answer ( $this-&gt;input-&gt;ip_address(), $this-&gt;input-&gt;post('recaptcha_challenge_field',true), $this-&gt;input-&gt;post('recaptcha_response_field',true));

if ($resp-&gt;is_valid) {
                echo "You got it!";
} else {
                # set the error code so that we can display it
                $error = $resp-&gt;error;
}
</pre>
<h3>For mail hide functions</h3>
<p>To use mail hide function, set mail hide api keys -</p>
<pre class="brush:php">
// Get a key from https://www.google.com/recaptcha/admin/create
$this-&gt;recaptcha-&gt;set_key ('XXXXXXXXXX Key XXXXXXXXX' ,'public') // For public key
$this-&gt;recaptcha-&gt;set_key ('XXXXXXXXXX Key XXXXXXXXX' ,'private') // For private key
</pre>
<p>The Mailhide version of example@example.com is</p>
<pre class="brush:php">
echo $this-&gt;recaptcha-&gt;recaptcha_mailhide_html ("example@example.com");
</pre>
<p>The url for the email is:</p>
<pre class="brush:php">
echo $this-&gt;recaptcha-&gt;recaptcha_mailhide_url ("example@example.com");
</pre>
<h3><a href="http://www.thetechspace.com/?download=recaptcha-ci-library" target="_blank">Download reCAPTCHA Codeigniter Library</a> ( size 4 kB)</h3>
<p>Hope it&#8217;s useful. Enjoy !!!</p>
<div class="shr-publisher-350"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2011/03/04/recaptcha-plugin-for-php-codeigniter/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Difference between php mysql functions mysql_fetch_object(), mysql_fetch_assoc() and mysql_fetch_array()</title>
		<link>http://www.thetechspace.com/2010/12/01/difference-between-php-mysql-functions-mysql_fetch_object-mysql_fetch_assoc-and-mysql_fetch_array/</link>
		<comments>http://www.thetechspace.com/2010/12/01/difference-between-php-mysql-functions-mysql_fetch_object-mysql_fetch_assoc-and-mysql_fetch_array/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 09:40:43 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Knowledge]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=335</guid>
		<description><![CDATA[Some of my friends are asked me. What&#8217;s difference between php functions mysql_fetch_object(), mysql_fetch_assoc() and mysql_fetch_array()? and how to use it ? If you also don&#8217;t known about it , please have a look example codes below. I think you would understand it. mysql_fetch_object() while ($each= mysql_fetch_object($result)) { echo $each->first_name; echo $each->last_name; } mysql_fetch_assoc() while [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Some of my friends are asked me. What&#8217;s difference between php functions mysql_fetch_object(), mysql_fetch_assoc() and mysql_fetch_array()? and how to use it ? If you also don&#8217;t known about it , please have a look example codes below. I think you would understand it.<br />
</p>
<h3>mysql_fetch_object()</h3>
<pre class="brush:php">
while ($each= mysql_fetch_object($result)) {
    echo $each->first_name;
    echo $each->last_name;
}
</pre>
<p></p>
<h3>mysql_fetch_assoc()</h3>
<pre class="brush:php">
while ($each= mysql_fetch_assoc($result)) {
    echo $each["first_name"];
    echo $each["last_name"];
}
</pre>
<p></p>
<h3>mysql_fetch_array()</h3>
<pre class="brush:php">
while ($each= mysql_fetch_array($result)) {
    echo $each[0];
    echo $each[1] ;
}
</pre>
<div class="shr-publisher-335"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/12/01/difference-between-php-mysql-functions-mysql_fetch_object-mysql_fetch_assoc-and-mysql_fetch_array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Unlimited Parent and Child in PHP</title>
		<link>http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/</link>
		<comments>http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/#comments</comments>
		<pubDate>Fri, 21 May 2010 08:12:39 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=321</guid>
		<description><![CDATA[Well, let me ask you first. Have you already known about recursion? If not, recursion mean reuse function in this function. How is it ? For eg Like function one_function ($var){ one_function(332); } OK , So , how to related with this post title ? I would like to say absolutely related with recursion. Let&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Well, let me ask you first. Have you already known about recursion? If not, recursion mean reuse function in this function.</p>
<p>How is it ? For eg Like</p>
<pre class="brush:php">function one_function ($var){
           one_function(332);
}
</pre>
<p>OK , So , how to related with this post title ? I would like to say absolutely related with recursion. Let&#8217;s say, we would like to create category with parent and child.so, we have one table in database, category table. Table Structure Like:</p>

<table id="wp-table-reloaded-id-1-no-1" class="wp-table-reloaded wp-table-reloaded-id-1">
<thead>
	<tr class="row-1 odd">
		<th class="column-1">id</th><th class="column-2">name</th><th class="column-3">p_id</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">1</td><td class="column-2">Main Parent</td><td class="column-3">0</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">2</td><td class="column-2">Sub Parent</td><td class="column-3">1</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">3</td><td class="column-2">Child</td><td class="column-3">2</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">4</td><td class="column-2">Parent 2</td><td class="column-3">0</td>
	</tr>
	<tr class="row-6 even">
		<td class="column-1">5</td><td class="column-2">Child 2</td><td class="column-3">4</td>
	</tr>
	<tr class="row-7 odd">
		<td class="column-1">6</td><td class="column-2">Child 3</td><td class="column-3">4</td>
	</tr>
	<tr class="row-8 even">
		<td class="column-1">7</td><td class="column-2">Child 4</td><td class="column-3">5</td>
	</tr>
</tbody>
</table>

<p><span id="more-321"></span>So, now I have created one table. I would like to get the out put like:</p>
<p>Main Parrent<br />
- Sub Parent<br />
&#8211; Child of sub parent<br />
Parent 2<br />
-  Child 2<br />
&#8211; Child of child 2<br />
- Child 3</p>
<p>So, how will you do it? How could we get it?</p>
<p>If you write the codes like, for eg :</p>
<pre class="brush:php">   $result = mysql_query ();
   while ( $row = mysql_fetch_assoc($result) ){

      echo $row[name];

      $result = mysql_query ();
      while ( $row = mysql_fetch_assoc($result) ){

            echo '- '.$row[name];
      }

   }
</pre>
<p>It would be work. But. If you have 3 or 4 or 5 levels and so on, you will got the trouble. So, what is the better way for that table? Shell we use recursion ?</p>
<p>I have written some code snippets like :</p>
<pre class="brush:php">
function display_child($parent, $level)
{
	$sql = "SELECT * from `category` WHERE p_id='$parent'";
	$result = mysql_query($sql);
	while ($row = mysql_fetch_array($result))
	{
		echo str_repeat('-',$level)." ".$row['name']."&lt;br /&gt;";
		display_child($row['id'], $level+1);
	}
}
</pre>
<p>Usage &#8211; display_child( parent_id, level )</p>
<pre class="brush:php">     display_children(0,0);
</pre>
<p>I hope it would be useful for some of your projects. Enjoy !!!!</p>
<h3><a href="http://www.thetechspace.com/?download=php_recursion" target="_blank">Download Source</a> ( size 1.1 kB)</h3>
<div class="shr-publisher-321"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/05/21/get-unlimited-parent-and-child-in-php/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>MySQL next and previous record of the current record</title>
		<link>http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/</link>
		<comments>http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 11:11:21 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=311</guid>
		<description><![CDATA[I have thought a lot these days what I should write some tips for beginner. Now, I got it. Have you ever noticed when you visiting and reading on some blogs? You will see previous and next links of current post. I don&#8217;t mean pagination links. If you have seen , have you ever thought [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I have thought a lot these days what I should write some tips for beginner. Now, I got it. Have you ever noticed when you visiting and reading on some blogs? You will see previous and next links of current post. I don&#8217;t mean pagination links. If you have seen , have you ever thought how to retrieve those data from MySQL ? OK , If you haven&#8217;t thought and tried yet. Let&#8217;s see how to do it.</p>
<p>Let says, we have user table. Normally, we write SQL query like :</p>
<pre class="brush:sql">SELECT * FROM user WHERE user_id = 111
</pre>
<p>OK, If your user_id is added by auto increment, it&#8217;s simply write 111 &#8211; 1 and 111 + 1 in your program. If not, how could we got it?<br />
Let&#8217;s see.</p>
<pre class="brush:sql">SELECT *,
(SELECT user_id FROM user WHERE user_id &lt; u.user_id ORDER BY user_id DESC LIMIT 1) AS user_prev,
(SELECT user_id FROM user WHERE user_id &gt; u.user_id ORDER BY user_id ASC LIMIT 1) AS user_next
FROM user AS u WHERE u.user_id=111
</pre>
<p>Enjoy !!! I hope it would be useful for you.</p>
<div class="shr-publisher-311"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/04/07/mysql-next-and-previous-record-of-the-current-record/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to return more than one value or multi value in PHP</title>
		<link>http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/</link>
		<comments>http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 01:13:45 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=297</guid>
		<description><![CDATA[Some of PHP beginners (my friends) always ask me how to return two or more values from function. So , I thought, I may need to write the beginner tip at The Tech Space Blog. If your the advanced PHP programmer, you will say. So easy, It&#8217;s a piece of cake. For beginner, it would [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Some of PHP beginners (my friends) always ask me how to return two or more values from function. So , I thought, I may need to write the beginner tip at The Tech Space Blog. If your the advanced PHP programmer, you will say. So easy, It&#8217;s a piece of cake. For beginner, it would be a little difficult. So, let&#8217;s see how to write it.</p>
<p>For normal function ..</p>
<pre class="brush:php">
&lt;?

function calc ( $a, $b)
{

$sum = $a+$b;
return $sum;

}

echo $calc(2,3);

?&gt;
</pre>
<p>So, If you would like to return two or more value from that function, just only return as an array. Let&#8217;s see.</p>
<pre class="brush:php">
&lt;?php

function calc($a,$b){

$sum = $a+$b;
$multiply = $a * $b;
$divided = $a/$b;
$modulus = $a%$b;

return array( 'sum'=&gt;$sum, 'multiply'=&gt;$multiply, 'divided'=&gt; $divided, 'modulus'=&gt;$modulus );

}

$data = calc(3,4);

echo 'Sum value: '.$data['sum'].'&lt;br /&gt;';
echo 'Multiply value: '.$data['multiply'].'&lt;br /&gt;';
echo 'Divided value: '.$data['divided'].'&lt;br /&gt;';
echo 'Modulus value: '.$data['modulus'].'&lt;br /&gt;';

?&gt;
</pre>
<p>Enjoy !!!</p>
<div class="shr-publisher-297"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2010/03/28/how-to-return-more-than-one-value-or-multi-value-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WP Plugin: Latest Posts by Category Archive</title>
		<link>http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/</link>
		<comments>http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 06:05:30 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=289</guid>
		<description><![CDATA[I have found one plugin for one of my client project . That is latest posts by category. I thought someone would be looking for that kind of plug in like me. That plug in can show posts from categories. Posts can be limit how many post what you would like to show under categories. [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I have found one plugin for one of my client project . That is <a href="http://blogsessive.com/blogging-tools/wp-plugin-latest-posts-by-category-archive/" target="_blank">latest posts by category</a>. I thought someone would be looking for that kind of plug in like me. That plug in can show posts from categories. Posts can be limit how many post what you would like to show under categories.</p>
<p>Features of &#8220;<a href="http://blogsessive.com/blogging-tools/wp-plugin-latest-posts-by-category-archive/" target="_blank">Latest Posts by Category Archive</a>&#8221;</p>
<blockquote>
<ul>
<li>Can be used via hard-coding inside page templates;</li>
<li>Can be used as a widget in your widget-ready areas;</li>
<li>Can be used via shortcodes inside pages’ or posts’ content;</li>
<li>Can be used either inside or outside the loop;</li>
<li>Can limit the archive to certain categories, or exclude certain categories;</li>
<li>Can display or hide post dates;</li>
<li>Can display or hide post excerpts and adjust their length in words;</li>
<li>Can set the number of listed post from 1 to ‘all’.</li>
</ul>
</blockquote>
<p><a href="http://blogsessive.com/blogging-tools/wp-plugin-latest-posts-by-category-archive/" target="_blank">To Download</a></p>
<div class="shr-publisher-289"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/12/08/wp-plugin-latest-posts-by-category-archive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Output XML using PHP from MySQL database</title>
		<link>http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/</link>
		<comments>http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 05:24:15 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=279</guid>
		<description><![CDATA[Firstly, Let me talk about this post. If your advance level php programmer, this is a piece of cake for you. I would like to say this post for beginner level. It would be a little difficult for a beginner. You may need xml output when you want to integrate with flash and MySQL records [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Firstly, Let me talk about this post. If your advance level php programmer, this is a piece of cake for you. I would like to say this post for beginner level. It would be a little difficult for a beginner. You may need xml output when you want to integrate with flash and MySQL records such as photo gallery, playlist for flash mp3 player, RSS Feeds, and so on.</p>
<p><span id="more-279"></span>I would like to show you an example to create xml playlist. So you can use this in flash mp3 player like JW Player. I have created songs table in my database. songs_id, album_id, songs_title and songs_link fields are included in this table.</p>
<p>In PHP file :</p>
<pre class="brush:php">
&lt;?php
 header('Content-type: text/xml');
 $db_host = &quot;localhost&quot; ; // MySQL Host
 $db_user = &quot;root&quot; ;    // Database Username
 $db_password = &quot;&quot; ; // Database Password
 $db_name = &quot;music&quot; ; // Database Name

 $db_link = mysql_connect(&quot;$db_host&quot;,&quot;$db_user&quot;,&quot;$db_password&quot;);
 mysql_select_db($db_name, $db_link);

?&gt;
 &lt;playlist version=&quot;1&quot; xmlns=&quot;http://xspf.org/ns/0/&quot;&gt;
 &lt;trackList&gt;
 &lt;?php
 $album_id = $_GET[aid];
 $songs = &quot;SELECT * From songs WHERE album_id='$album_id' ORDER BY song_title ASC&quot;;
 $songs_list = mysql_query( $songs, $db_link );
 $songs_total = mysql_num_rows( $songs_list );
 if( $songs_total == 0 )    {    exit;    }
 for( $f = 0; $f &lt; $songs_total; $f++ )
 {
 $each = mysql_fetch_assoc( $songs_list );
 ?&gt;
 &lt;track&gt;
 &lt;title&gt;&lt;?=$each['song_title']?&gt;&lt;/title&gt;
 &lt;location&gt;http://www.yourdomain.com/&lt;?=$each['song_link']?&gt;&lt;/location&gt;
 &lt;/track&gt;
 &lt;?php

 } // End of loop

 ?&gt;
 &lt;/trackList&gt;
 &lt;/playlist&gt;
</pre>
<p>Then you can use call this file with album id like <strong>xml.php?aid=10</strong>.</p>
<h3><a href="http://www.thetechspace.com/?download=php_xml_output" target="_blank">Download Source</a> ( size 745 B)</h3>
<div class="shr-publisher-279"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/11/14/output-xml-using-php-from-mysql-database/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Pagination</title>
		<link>http://www.thetechspace.com/2009/11/11/php-pagination/</link>
		<comments>http://www.thetechspace.com/2009/11/11/php-pagination/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 12:38:32 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=268</guid>
		<description><![CDATA[I have look for php pagination source. I got one very nice source code from Stranger Studio. That very nice code if your have a lot of records. You can see at sample preview. However, this is a lot of lines in the file. If you want to put into a lot of pages, all [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I have look for php pagination source. I got one very nice source code from <a href="http://www.strangerstudios.com/sandbox/pagination/diggstyle.php">Stranger Studio</a>. That very nice code if your have a lot of records. You can see at sample preview.</p>
<p style="text-align: center;"><img class="size-full wp-image-269 aligncenter" title="PHP Pagination" src="http://www.thetechspace.com/wp-content/uploads/2009/11/php_pagination.jpg" alt="PHP Pagination" width="457" height="33" /></p>
<p>However, this is a lot of lines in the file. If you want to put into a lot of pages, all of code you need to put into those pages. We have to take care about this. That&#8217;s while I have changed to class and functions. That&#8217;s very easy to use. I will share it back.</p>
<p><span id="more-268"></span></p>
<p>Firstly I have created class and function in the <strong>paganition.php</strong> file.</p>
<p>For usage :</p>
<pre class="brush:php">

require_once('pagination.php');
 $sql = 'SELECT * FROM contact';
 $page_name = &quot;page.php&quot;;

 //  pagination($query, $adjacents, $row_per_page, $page_name)
 $pager = new pagination($sql, 3, 20, $page_name );
 $rs = $pager-&gt;paginate();

 while($each = mysql_fetch_assoc($rs))
 {
 // Your Loop Here
 echo $each[name];
 }

 // Pages Navagation
 echo $pager-&gt;pages();
</pre>
<p>So, Page links will be come like &#8220;<strong>pagename.php?page=</strong>&#8221; . If you would like to use with <strong>.htaccess</strong> some think like http://www.yourdomain.com/content/page/page_number , you can easily to change at <strong>pagination.php</strong> . Find, &#8220;<strong>?page=</strong>&#8221; and replace with &#8220;/&#8221; . Then, you can use at page name like</p>
<pre class="brush:php">

$page_name = &quot;http://www.yourdomain.com/content/page&quot;;
</pre>
<p>In CSS.</p>
<pre class="brush:css">

div.pagination {
 padding: 3px;
 margin: 3px;
}

div.pagination a {
 padding: 2px 5px 2px 5px;
 margin: 2px;
 border: 1px solid #AAAADD;

 text-decoration: none; /* no underline */
 color: #000099;
}

div.pagination a:hover, div.pagination a:active {
 border: 1px solid #000099;

 color: #000;
}

div.pagination span.current {
 padding: 2px 5px 2px 5px;
 margin: 2px;
 border: 1px solid #000099;

 font-weight: bold;
 background-color: #000099;
 color: #FFF;
}
div.pagination span.disabled {
 padding: 2px 5px 2px 5px;
 margin: 2px;
 border: 1px solid #EEE;

 color: #DDD;
}
</pre>
<h3><a href="http://www.thetechspace.com/?download=php_pagination" target="_blank">Download Source</a> ( size 2.6 kB)</h3>
<div class="shr-publisher-268"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/11/11/php-pagination/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to parse xml in php?</title>
		<link>http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/</link>
		<comments>http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 08:33:46 +0000</pubDate>
		<dc:creator>Thurein</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.thetechspace.com/?p=256</guid>
		<description><![CDATA[When I started and learn php programming language. I have wanted to get data from xml file and read with php. I searched with Google. I got a lot of source codes. Some of codes are working in my local machine but when I upload and test it. It doesn&#8217;t work. I have found some [...]]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>When I started and learn php programming language. I have wanted to get data from xml file and read with php. I searched with Google. I got a lot of source codes. Some of codes are working in my local machine but when I upload and test it. It doesn&#8217;t work. I have found some codes are work with almost all of server. I will share it back.</p>
<p><span id="more-256"></span>Firstly, I have created example xml file as songs.xml like :</p>
<pre class="brush:xml">

&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;currentsongs&gt;
&lt;song&gt;
&lt;title&gt;Song Title One&lt;/title&gt;
&lt;artist&gt;artist name&lt;/artist&gt;

&lt;/song&gt;

&lt;song&gt;
&lt;title&gt;Song Title Two&lt;/title&gt;
&lt;artist&gt;Sec artist name&lt;/artist&gt;

&lt;/song&gt;
&lt;/currentsongs&gt;
</pre>
<p>Then in php file :</p>
<pre class="brush:php">
&lt;?php

$objDOM = new DOMDocument();
$objDOM-&gt;load("songs.xml"); //make sure path is correct

$songs = $objDOM-&gt;getElementsByTagName("song");

foreach( $songs as $value )
{
$title = $value-&gt;getElementsByTagName("title");
$song_title  = $title-&gt;item(0)-&gt;nodeValue;

$artist = $value-&gt;getElementsByTagName("artist");
$artist_name  = $artist-&gt;item(0)-&gt;nodeValue;

echo "$song_title - $artist_name &lt;br&gt;";
}

?&gt;
</pre>
<h3><a href="http://www.thetechspace.com/?download=php_xml_read" target="_blank">Download Source</a> ( size 868 B)</h3>
<div class="shr-publisher-256"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.thetechspace.com/2009/11/05/how-to-parse-xml-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
