<?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>SentientCreations &#187; PHP</title>
	<atom:link href="http://sentientcreations.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://sentientcreations.com</link>
	<description></description>
	<lastBuildDate>Tue, 29 Nov 2011 19:03:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>count_all_results() and get_where() in CodeIgniter</title>
		<link>http://sentientcreations.com/2011/11/29/count_all_results-and-get_where-in-codeigniter/</link>
		<comments>http://sentientcreations.com/2011/11/29/count_all_results-and-get_where-in-codeigniter/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 19:01:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[count_all_results]]></category>
		<category><![CDATA[get_where]]></category>

		<guid isPermaLink="false">http://sentientcreations.com/?p=72</guid>
		<description><![CDATA[<p>This silly little mistake tripped me up for a bit this morning and I only figured it out after some searching. Based on the results I&#8217;m not the only person that has hit this roadblock, so here is the solution.</p>
<p>I was doing a normal query that looked something like this:</p>
$read_db = $this-&#62;load-&#62;database('read', TRUE);
$query = $read_db-&#62;get_where(array('username' [...]]]></description>
			<content:encoded><![CDATA[<p>This silly little mistake tripped me up for a bit this morning and I only figured it out after some searching. Based on the results I&#8217;m not the only person that has hit this roadblock, so here is the solution.</p>
<p>I was doing a normal query that looked something like this:</p>
<pre>$read_db = $this-&gt;load-&gt;database('read', TRUE);
$query = $read_db-&gt;get_where(array('username' =&gt; $username, 'password' =&gt; $password));</pre>
<p>Due to some changes in how my application works, I needed to change that from a query that returned a result to a query that just returned the number of items in the query.</p>
<p>So I changed the code above to be:</p>
<pre>$read_db = $this-&gt;load-&gt;database('read', TRUE);
$read_db-&gt;get_where(array('username' =&gt; $username, 'password' =&gt; $password));
$count = $read_db-&gt;count_all_results();</pre>
<p>This code would just return a 1 regardless of what the parameters in the where clause were. After a bit of searching I ran across <a href="http://codeigniter.com/forums/viewthread/88352/" target="_blank">this forum post</a> that told me what the issue was. You should only use get_where() if you actually want to return a result. The correct syntax for this query is:</p>
<pre>$read_db = $this-&gt;load-&gt;database('read', TRUE);
$read_db-&gt;where(array('username' =&gt; $username, 'password' =&gt; $password));
$read_db-&gt;from('admin');
$count = $read_db-&gt;count_all_results();</pre>
<p>This now returns the correct result every time. Silly mistake caused by my misreading the documentation, but it still took a bit to figure it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://sentientcreations.com/2011/11/29/count_all_results-and-get_where-in-codeigniter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Today I Made&#8230;</title>
		<link>http://sentientcreations.com/2011/11/21/today-i-made/</link>
		<comments>http://sentientcreations.com/2011/11/21/today-i-made/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 03:19:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sentientcreations.com/?p=62</guid>
		<description><![CDATA[<p></p>
<p>Today I started a new personal project that I&#8217;m hoping is going to be a lot of fun. Right now I&#8217;m calling it &#8220;Today I Made&#8221;, although I&#8217;m not sure that will be final name until I can secure some sort of domain name I like.</p>
<p>The idea of the site is that you will be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sentientcreations.com/wp-content/uploads/2011/11/chicago-20101112-_MG_0782.jpg"><img class="alignnone size-full wp-image-63" title="Tow Zone" src="http://sentientcreations.com/wp-content/uploads/2011/11/chicago-20101112-_MG_0782.jpg" alt="" width="500" /></a></p>
<p>Today I started a new personal project that I&#8217;m hoping is going to be a lot of fun. Right now I&#8217;m calling it &#8220;Today I Made&#8221;, although I&#8217;m not sure that will be final name until I can secure some sort of domain name I like.</p>
<p>The idea of the site is that you will be able to login and post something that you &#8220;made&#8221;. Made is in quotes because I want to be quite inclusive. For instance, one day I made that image you see up there. Today, I made some nifty CodeIgniter code that lets you upload a file and then drops the content into a database. Maybe tomorrow I&#8217;ll make a pie, or paint a picture or build a shelf, who knows? Essentially, I just want people to be able to showcase the things that they actually create by uploading a picture or linking to their blog or just telling everyone about it.</p>
<p>Eventually I hope to add Facebook and Twitter integration, up-voting, badges and all that other Web 2.0 type stuff that every site just needs. But I&#8217;ll start simple and build it up as I go and see what people like. I&#8217;m hoping that it will give me the chance to build something fun and at the same time get to use some technology that I don&#8217;t get to play with all the time at my day job.</p>
<p>Want to follow along as I get going? You can follow along on github here: <a href="https://github.com/cliffjohnson/todayimade">https://github.com/cliffjohnson/todayimade</a>. I need to get an open source license applied to this project, I think there might be a couple of different applications for it once it&#8217;s done, but that is another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://sentientcreations.com/2011/11/21/today-i-made/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add A New Products Section to a Magento Store Homepage</title>
		<link>http://sentientcreations.com/2009/12/19/add-a-new-products-section-to-a-magento-store-homepage/</link>
		<comments>http://sentientcreations.com/2009/12/19/add-a-new-products-section-to-a-magento-store-homepage/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 16:08:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ecommerce]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sentientcreations.com/?p=30</guid>
		<description><![CDATA[<p>Was looking for a way to add a New Products section to the homepage of a Magento store I&#8217;m working on a found a great write up on Richard Castera&#8217;s blog. All you really have to do is add this code to the homepage code in your CMS section:</p>
<p>{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage"template="catalog/product/new.phtml"}}</p>
<p>Check out the full [...]]]></description>
			<content:encoded><![CDATA[<p>Was looking for a way to add a New Products section to the homepage of a Magento store I&#8217;m working on a found a great write up on Richard Castera&#8217;s blog. All you really have to do is add this code to the homepage code in your CMS section:</p>
<p><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: #000000 !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">{{block type=</code><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: blue !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">"catalog/product_new"</code> <code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: #000000 !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">name=</code><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: blue !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">"home.catalog.product.new"</code> <code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: #000000 !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">alias=</code><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: blue !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">"product_homepage"</code><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: #000000 !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">template=</code><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: blue !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">"catalog/product/new.phtml"</code><code style="outline-width: 0px !important; outline-style: initial !important; outline-color: initial !important; background-image: none !important; background-attachment: initial !important; background-origin: initial !important; background-clip: initial !important; background-color: initial !important; text-align: left !important; float: none !important; vertical-align: baseline !important; position: static !important; left: auto !important; top: auto !important; right: auto !important; bottom: auto !important; height: auto !important; width: auto !important; line-height: 1.1em !important; font-family: Consolas, Monaco, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important; font-weight: normal !important; font-style: normal !important; font-size: 11px; display: inline !important; color: #000000 !important; background-position: initial initial !important; background-repeat: initial initial !important; padding: 0px !important; margin: 0px !important; border: 0px !important initial !important initial !important;">}}</code></p>
<p>Check out the <a href="http://www.richardcastera.com/2009/05/21/magento-display-new-products-on-the-home-page/" target="_blank">full blog post</a> with some great back and forth and troubleshooting tips.</p>
<p>Once you have the new products displaying, <a href="http://www.magentocommerce.com/boards/viewthread/16287/" target="_blank">this post on the Magento site</a> will show you how to have more than five products displayed and how to add more than one row.</p>
]]></content:encoded>
			<wfw:commentRss>http://sentientcreations.com/2009/12/19/add-a-new-products-section-to-a-magento-store-homepage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could It Really Be That Easy?</title>
		<link>http://sentientcreations.com/2009/12/01/could-it-really-be-that-easy/</link>
		<comments>http://sentientcreations.com/2009/12/01/could-it-really-be-that-easy/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 22:37:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sentientcreations.com/?p=28</guid>
		<description><![CDATA[<p>In a project we are working on we needed a way to extract the number portion of a weight from a string. So we could receive any of the following:</p>
<p>21
21 lbs
21.3
21.3 lbs</p>
<p>We started looking into some regular expressions to do the job, but then ran across a page saying that you can just cast it [...]]]></description>
			<content:encoded><![CDATA[<p>In a project we are working on we needed a way to extract the number portion of a weight from a string. So we could receive any of the following:</p>
<p>21<br />
21 lbs<br />
21.3<br />
21.3 lbs</p>
<p>We started looking into some regular expressions to do the job, but then ran across a page saying that you can just cast it to a float or int and it will drop the string bit automatically like so:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 22px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">&lt;?php</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 22px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">$string = &#8220;22.8 lbs&#8221;;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 22px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">echo (float)$string;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 22px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">?&gt;</div>
<p>&lt;?php<br />
$string = &#8220;22.8 lbs&#8221;;<br />
echo (float)$string;<br />
?&gt;</p>
<p>This should output 22.8. Not perfect for every situation, but pretty handy in the right one.</p>
]]></content:encoded>
			<wfw:commentRss>http://sentientcreations.com/2009/12/01/could-it-really-be-that-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

