<?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>Working Beta &#187; PHP</title>
	<atom:link href="http://seeds.workingbeta.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://seeds.workingbeta.com</link>
	<description>a bounch of nearly working code</description>
	<lastBuildDate>Wed, 10 Feb 2010 21:25:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ready&#8230; set&#8230; go!</title>
		<link>http://seeds.workingbeta.com/2009/05/14/ready-set-go/</link>
		<comments>http://seeds.workingbeta.com/2009/05/14/ready-set-go/#comments</comments>
		<pubDate>Thu, 14 May 2009 18:44:22 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[RAD]]></category>
		<category><![CDATA[VISUAL PHP]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=49</guid>
		<description><![CDATA[Hi all,
so much time since my last post! I&#8217;ve been involved into so many interesting projects that I could&#8217;t even login.
In the meantime a brand new side project idea is born.. All stats looking at the bleeding edge of the CMS/CMR/Framework panorama that I&#8217;ve encountered in the last month. None of them is really well [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,<br />
so much time since my last post! I&#8217;ve been involved into so many interesting projects that I could&#8217;t even login.</p>
<p>In the meantime a brand new side project idea is born.. All stats looking at the bleeding edge of the CMS/CMR/Framework panorama that I&#8217;ve encountered in the last month. None of them is really well suite for rapid application developement in  L(W)AMP environments. What is missing actually is a real visual IDE that fits into your browsers, and helps you deploy a consisten, secure, fast paced application starting from a simple set of tables/relations.</p>
<p>Something like the old visual basic stuff, but integrated with all the latest AJAX widgets and user experience. why should people still develop every single template/form/interface instead of simply concentrate in business logic?</p>
<p>so stay tuned, first lines of code are ready, as usual with prototype &amp; usual suspects in the frontline.<br />
I will publish one module/element/schema/idea per week, any help is greatly appreciated!!</p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2009/05/14/ready-set-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>class.dbmanager.php</title>
		<link>http://seeds.workingbeta.com/2008/11/18/classdbmanagerphp/</link>
		<comments>http://seeds.workingbeta.com/2008/11/18/classdbmanagerphp/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 15:51:28 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[dbmanagement]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[singleton]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=19</guid>
		<description><![CDATA[here we go, a simple, very basic class to manage DB connections; I know there are so many around BUT

it&#8217;s very lightweight because it:
makes use of the &#8220;singleton&#8221; pattern, so you can start make a mess with patterns [if you've never do so]
ther&#8217;s soo much room for improvement
since I use it on an almost everyday [...]]]></description>
			<content:encoded><![CDATA[<p>here we go, a simple, very basic class to manage DB connections; I know there are so many around <strong>BUT</strong></p>
<ol>
<li>it&#8217;s very lightweight because it:</li>
<li>makes use of the &#8220;<a href="http://en.wikipedia.org/wiki/Singleton_pattern" target="_blank">singleton</a>&#8221; pattern, so you can start make a mess with <a href="http://en.wikipedia.org/wiki/Design_pattern" target="_blank">patterns</a> [if you've never do so]</li>
<li>ther&#8217;s soo much room for improvement</li>
<li>since I use it on an almost everyday basis anyother of my seeds will use it, so get used to it!</li>
</ol>
<p>When you deal with mysql connections you should keep in mind that every single connection takes its load or system resources, and if you don&#8217;t pay attentio you could easily end up into a &#8216;<em>too many connections</em>&#8216; error and a faulty applications.<br />
The very first solutions would be trying to use persistent connections, and this works very well on the mysql side: every page builds just one connection. The singleton pattern is chosen here because off it has a very low footprint into system resources: this means that you free more resources for the rest of your <span style="text-decoration: line-through;">crappy</span> code.</p>
<p>After creating your <strong>dbmanager</strong> Object, you have to <strong>dbmanager::connect </strong>giving host, user, pwd, db as always. from now on, you will have basically two methods:</p>
<p style="text-align: center;"><strong>dbmanager::assocQuery($sql)</strong> and <strong>dbmanager::sqlQuery($sql)</strong></p>
<p>those two methods just query the database with the given query [there are also some nice counters if you wanna know how many querys ar made for every page you build].<br />
The nice thing about dbmanager::assocQuery($sql) is how the result is returned: an associative array with fieldnames as keys: that&#8217;s really useful when you then have to cycle through your recordset and build tables, analyze data and so on.</p>
<blockquote><p><code><br />
$db=new dbconnection("mysql");<br />
$db-&gt;connect($host,$login,$password,$database);<br />
$recordset=$db-&gt;assocQuery("SELECT * FROM TABLENAME WHERE CONDITIONS...");<br />
foreach($recordset as $record){<br />
&nbsp;&nbsp;&nbsp;&nbsp;// here goes your code<br />
&nbsp;&nbsp;&nbsp;&nbsp;}</code>
</p></blockquote>
<p>very straightforward, isn&#8217;t it???</p>
<p>uh.. the code is <a href="http://www.workingbeta.com/seeds/dbmanager.zip">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2008/11/18/classdbmanagerphp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>__autoload</title>
		<link>http://seeds.workingbeta.com/2008/11/13/__autoload/</link>
		<comments>http://seeds.workingbeta.com/2008/11/13/__autoload/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 12:19:28 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[__autoload]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=10</guid>
		<description><![CDATA[don&#8217;t know if you already use this
function __autoload($class){
&#160;&#160;&#160;&#160;# autoloading of a class #
&#160;&#160;&#160;&#160;if (file_exists("classes/class.".$class.".php"))
&#160;&#160;&#160;&#160;include_once("classes/class.".$class.".php");
&#160;&#160;&#160;&#160;else print "Failed to auto-load classes/class.{$class}.php";
&#160;&#160;&#160;&#160;}

it&#8217;s a little snippet of PHP code who take care of autoloading a class when you try to use it and the relevant definition file hasn&#8217;t still been loaded.
As you can see, if you use a bit [...]]]></description>
			<content:encoded><![CDATA[<p>don&#8217;t know if you already use this</p>
<blockquote><p><code><br />function __autoload($class){<br />
&nbsp;&nbsp;&nbsp;&nbsp;# autoloading of a class #<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (file_exists("classes/class.".$class.".php"))<br />
&nbsp;&nbsp;&nbsp;&nbsp;include_once("classes/class.".$class.".php");<br />
&nbsp;&nbsp;&nbsp;&nbsp;else print "Failed to auto-load classes/class.{$class}.php";<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
</code></p></blockquote>
<p>it&#8217;s a little snippet of PHP code who take care of autoloading a class when you try to use it and the relevant definition file hasn&#8217;t still been loaded.<br />
As you can see, if you use a bit of naming convention and a solid file structure it could resolve many problems, expecially the neverending list of file inclusions at the beginning of your scripts.</p>
<p>Maybe some tweaks should be necessary to solve securiti issues, if you have any&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2008/11/13/__autoload/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
