<?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>Caneblu.com &#187; programming</title>
	<atom:link href="http://www.caneblu.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.caneblu.com</link>
	<description>Solo un altro blog targato WordPress</description>
	<lastBuildDate>Mon, 10 May 2010 20:32:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Fatal error: session_start(): Failed to initialize storage module:</title>
		<link>http://www.caneblu.com/2009/01/fatal-error-session_start-failed-to-initialize-storage-module/</link>
		<comments>http://www.caneblu.com/2009/01/fatal-error-session_start-failed-to-initialize-storage-module/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:14:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/caneblu/?p=27</guid>
		<description><![CDATA[If you get this error: Fatal error: session_start(): Failed to initialize storage module: The solution is changing your current php.ini settings for session.save_handler user to session.save_handler files. Edit your php.ini file from: [Session] ; Handler used to store/retrieve data. session.save_handler = user to [Session] ; Handler used to store/retrieve data. session.save_handler = files If you [...]]]></description>
			<content:encoded><![CDATA[<p>If you get this error:<br />
Fatal error: session_start(): Failed to initialize storage module:<br />
The solution is changing your current php.ini settings for session.save_handler user to session.save_handler files.</p>
<p>Edit your php.ini file from:</p>
<p><em> [Session]<br />
; Handler used to store/retrieve data.<br />
session.save_handler = user</em></p>
<p>to</p>
<p><em> [Session]<br />
; Handler used to store/retrieve data.<br />
session.save_handler = files</em></p>
<p>If you do not have access to the php.ini file, you may try an alternate .htaccess rewrite method. Edit your .htaccess and place the following lines:</p>
<p><em> RewriteEngine On<br />
php_value session.save_handler files</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/fatal-error-session_start-failed-to-initialize-storage-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel and PHP</title>
		<link>http://www.caneblu.com/2009/01/excel-and-php/</link>
		<comments>http://www.caneblu.com/2009/01/excel-and-php/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:12:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/caneblu/?p=25</guid>
		<description><![CDATA[From Office 97 version, the World famous spreadsheet can read html table&#8217;s like a spreadsheet rows and colums. With this interesting feature we can create .xls file on the fly from php with a simple play of &#60;table&#62; html tag. Here the code 1 2 3 4 5 6 7 8 9 10 11 12 [...]]]></description>
			<content:encoded><![CDATA[<p>From Office 97 version, the World famous spreadsheet can read html table&#8217;s like a spreadsheet rows and colums.<br />
With this interesting feature we can create .xls file on the fly from php with a simple play of &lt;table&gt; html tag.</p>
<p>Here the code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #000088;">$filename</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;spreadsheet.xls&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: application/vnd.ms-excel&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: inline; filename=<span style="color: #006699; font-weight: bold;">$filename</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My XLS title&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=&quot;0&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span><span style="color: #000088;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$j</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td&gt;<span style="color: #006699; font-weight: bold;">$a</span>&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/table&gt;
&lt;/body&gt;&lt;/html&gt;</pre></td></tr></table></div>

<p>With line 3 we exchange the html data to excel<br />
With line 4 we download the file insted of open ino the browser</p>
<p>as you can see, you can play with the table and collect data from a database, for generate some .xls spreadsheet on the fly, with the data you want for specific user, or specific situations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/excel-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL sample connection</title>
		<link>http://www.caneblu.com/2009/01/mysql-sample-connection/</link>
		<comments>http://www.caneblu.com/2009/01/mysql-sample-connection/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:07:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/caneblu/?p=23</guid>
		<description><![CDATA[Pre-requisites: Database host or IP Database name Username and password access of db. First we need to declare some critical data like username and password, so i strongly recommended to store this value into a different file where php will ask tables and data, this for security reason. In the php convension, usually we make [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Pre-requisites:</strong><br />
Database host or IP<br />
Database name<br />
Username and password access of db.</p>
<p>First we need to declare some critical data like username and password, so i strongly recommended to store this value into a different file where php will ask tables and data, this for security reason.</p>
<p>In the php convension, usually we make a file called config.inc.php, because the .inc between the file name and real extension, dont show nothing if directly called to your browser.</p>
<p>Let&#8217;s make this file usually called config.inc.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">      <span style="color: #000000; font-weight: bold;">&lt;?php</span>
      <span style="color: #666666; font-style: italic;">//database parameters</span>
      <span style="color: #000088;">$db_host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//usually localhost, but can be an IP</span>
      <span style="color: #000088;">$db_user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;myusername&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$db_password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mypassword&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$db_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mydatabasename&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now we must pass to php this values, if you are planning a project, usually is a good idea to make next step to a file called database.php and perform the connection.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">      <span style="color: #000000; font-weight: bold;">&lt;?php</span>
      <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;config.inc.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">//now check our usr/pass credentials</span>
      <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db_user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db_password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
      <span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;put here an error message&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">//now we see if database name can be read/write</span>
      <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span>
      or <span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ERROR: your parameteres are wrong&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>With <em>mysql_connect</em> your have ask a connection to database server with your username and password, usually on shared service, your credentials give access to one database, so the server must reply if you have a valid account on it. Be careful, the variables <em>$db_host, $db_user, $db_password</em> must be passed in the order of example above.</p>
<p>With <em>mysq_select_db</em> you ask the permission to read/write on database name, with previous credentials.<br />
Both functions are native PHP functions, and they can perform only a TRUE or FALSE, no database data is exchanged yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/mysql-sample-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
