<?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>eligeske &#187; PHP</title>
	<atom:link href="http://eligeske.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://eligeske.com</link>
	<description>My day to day journey through the world wide web.</description>
	<lastBuildDate>Tue, 15 Jun 2010 20:39:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Dynamic Constants</title>
		<link>http://eligeske.com/php/php-dynamic-constants/</link>
		<comments>http://eligeske.com/php/php-dynamic-constants/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 01:00:03 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=174</guid>
		<description><![CDATA[<img style="float: left;" src="http://eligeske.com/wp-content/uploads/2009/10/blog_php.png"   width="150" height="150" class="alignnone size-full wp-image-73" />I got this off the php.net website, haven't tried it yet. Uh ya, a Dynamic Constant, Jumbo Shrimp?<br/><br/>]]></description>
			<content:encoded><![CDATA[<p>This is a way to print out a constant when you need to select the name dynamically.</p>
<p>Haven&#8217;t tried it yet, but I am adding because I am sure I will need it in the near future.</p>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;">$changing_variable = 'foo_bar';
echo constant('FOO_' . strtoupper($changing_variable));</pre></div></p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/php/php-dynamic-constants/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Get Prior Date or Yesterday</title>
		<link>http://eligeske.com/php/php-get-prior-date-or-yesterday/</link>
		<comments>http://eligeske.com/php/php-get-prior-date-or-yesterday/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 20:15:58 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=152</guid>
		<description><![CDATA[<img style="float: left;" src="http://eligeske.com/wp-content/uploads/2009/10/blog_php.png"  title="PHP get day before" width="150" height="150" class="alignnone size-full wp-image-73" />PHP Quickie! Ever wonder how to get the date of one day or maybe even 2 days prior to a selected date? Pretty easy with mktime().<br/>]]></description>
			<content:encoded><![CDATA[<p>Here is a quickie to get the date prior to another date. You can make it one, two, 3 days prior. Doesn&#8217;t really matter. PHP&#8217;s mktime() function self corrects when you put in a day and subtract the number from it.<br />
Yes. Even if it 2010-01-01 it will go return 2009-12-31.</p>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;">function currWeek()
/**
 * Returns the date one day before the one entered, regardless of year or day of month.
 * Y-m-d
 * @return $dateBefore
 * @param object $mydate
*/
function getDayBefore($mydate){
	$mydate = explode(&quot;-&quot;, $mydate);
	$myyear 	= $mydate[0];
	$mymonth 	= $mydate[1];
	$myday		= $mydate[2];
	$dateBefore = mktime(0,0,0, $mymonth, $myday-1, $myyear);
	$dateBefore = date('Y-m-d',$dateBefore);
	return $dateBefore;
}</pre></div></p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/php/php-get-prior-date-or-yesterday/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Current Week Number</title>
		<link>http://eligeske.com/php/php-current-week-number/</link>
		<comments>http://eligeske.com/php/php-current-week-number/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 17:39:48 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=144</guid>
		<description><![CDATA[<img style="float: left;" src="http://eligeske.com/wp-content/uploads/2009/10/blog_php.png"   width="150" height="150" class="alignnone size-full wp-image-73" />PHP Quickie! I needed a function to get the current week. Not sure if it is 100% solid, so use on your own accord.<br/><br/>]]></description>
			<content:encoded><![CDATA[<p>I did not fully test this for every scenario and leap years.  But it worked for what I was using it for.  If anyone has any bugs with it, let me know.</p>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;">function currWeek()
{
$dateArray = getdate();
$yday = $dateArray['yday'];
$wday = $dateArray['wday'];
$cMon 	= $yday &amp;#8211; $wday;
$currWk = ceil($cMon/7);
return $currWk;
}</pre></div></p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/php/php-current-week-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress error in Apache log.</title>
		<link>http://eligeske.com/php/wordpress-error-in-apache-log/</link>
		<comments>http://eligeske.com/php/wordpress-error-in-apache-log/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 15:57:08 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=140</guid>
		<description><![CDATA[<img style="float: left;" src="http://eligeske.com/wp-content/uploads/2009/11/category-wordpress.jpg" alt="wordpress" title="wordpress" width="150" height="150" class="alignnone size-full wp-image-73" />Wordpress error in Apache log, WHERE category_nicename = , Could be many things creating this error. Here are some common and easy fixes.]]></description>
			<content:encoded><![CDATA[<p>This error was driving me nuts.</p>
<p>Error in Apache Log:<br />
[error] [client 127.0.0.1] WordPress database error Table &#8216;wp_categories&#8217; doesn&#8217;t exist for query SELECT cat_name FROM wp_categories WHERE category_nicename = &#8216;12&#8242; made by require, require_once, include, get_header, locate_template, load_template, require_once, breadcrumbs, referer:</p>
<p>I edited the core files to no end.  Of course the last thing I checked after four to five hours of hacking was the breadcrumb plugin by <a title="Visit author homepage" href="http://drnaylor.co.uk/">Daniel R Naylor</a>.  Because I was sending custom URL Params it was trying to grab the category out of a depecrated table.</p>
<p>FIX: Either use another breadrumb if your going to be using custom URL Parameters or edit the current one.<br />
&#8211; comment out this entire elseif statment:<br />
elseif ( !empty($category_name)</p>
<p>That keeps it from looking for that table and will end the errors.</p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/php/wordpress-error-in-apache-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Round Up to Nearest Hundred Function</title>
		<link>http://eligeske.com/php/php-round-up-to-nearest-hundred-function/</link>
		<comments>http://eligeske.com/php/php-round-up-to-nearest-hundred-function/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 22:32:14 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=97</guid>
		<description><![CDATA[<img style="float: left;" src="http://eligeske.com/wp-content/uploads/2009/10/blog_php.png" alt="jQuery-Star-Rating" title="jQuery-Star-Rating" width="150" height="150" class="alignnone size-full wp-image-73" />PHP Quickie! I needed a function to round up to nearest one hundred. Here it is... small short.<br/><br/>]]></description>
			<content:encoded><![CDATA[<p>Here is a PHP Quickie!</p>
<p>NEW:</p>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;">function roundNearestHundredUp($number)
{
return ceil( $number / 100 ) * 100;
}</pre></div></p>
<p>OLD:</p>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;">function roundNearestHundredUp($number){
$round = round($number, -2);
if($number &gt; $round){ $round = $round + 100;}
return $round;
}</pre></div></p>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/php/php-round-up-to-nearest-hundred-function/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP MySQL functions</title>
		<link>http://eligeske.com/mysql/php-mysql-functions/</link>
		<comments>http://eligeske.com/mysql/php-mysql-functions/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:27:07 +0000</pubDate>
		<dc:creator>eligeske</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://eligeske.com/?p=78</guid>
		<description><![CDATA[<img src="http://eligeske.com/wp-content/uploads/2009/10/blog_mysqlAndPhp.png" alt="jQuery-Star-Rating" title="jQuery-Star-Rating" width="150" height="150" class="alignnone size-full wp-image-73" /> PHP makes grabbing and inserting data into a MySQL database a breeze.  There are many, many, ways into doing this but here is a couple of the base ways to connect, insert, query, and close connections. Also a little help with comparison and selection SQL Statements. ]]></description>
			<content:encoded><![CDATA[<p>Connecting to MySQL is pretty simple. There are several different ways of doing it through PHP like MySQLi and PDO.  The way I usually do it is creating a mysql class that contains the connect, close, select, insert, and all the other functions readily needed for using PHP and MySQL.  Unfortunately some clients that I work with don’t always use PHP 5 or higher.. <img src='http://eligeske.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />     So here is the way to connect just using functions so that it will work with earlier versions of PHP.</p>
<p>You can assign the database connection properties as variables, contants, or hard coded. Today I am going to pass variables into the function.  You could also get much more detailed with it and make error handling if connection fails, but again… not today.</p>
<p>Also below is all the necessary PHP MySQL function. Check em. Good for Reference when not using a framework.</p>
<h3>MySQL CONNECT</h3>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_connect"><span style="color: #990000;">mysql_connect</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;DB_HOST&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;DB_USER&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;DB_PASSWORD&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div>
<h3>MySQL CLOSE</h3>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<a href="http://www.php.net/mysql_close"><span style="color: #990000;">mysql_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div>
<h3>MySQL QUERIES</h3>
<div class="wp-synhighlighter-inner"><pre class="php" style="font-family:arial;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// INSERT</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO table(field1, field2) VALUES('value1', 'value2' ) &quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// SELECT</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO table(field1, field2) VALUES('value1', 'value2' ) &quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// WHERE</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1='value1'&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// ORDER BY</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table ORDER BY fieldName&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// GROUP BY with ORDER BY (NOTE: GROUP BY must come before ORDER BY)</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table GROUP BY fieldName ORDER BY  fieldName&quot;</span><span style="color: #009900;">&#41;</span> or  <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// LIMIT</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM `your_table` LIMIT 0, 10&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/mysql_error"><span style="color: #990000;">mysql_error</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// WHERE CONDITIONALS ..more</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1='value1' OR field2='value2'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1='value1' &amp;&amp; field2='value2'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// COMPARISONS</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1 LIKE value%&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1 NOT LIKE value%&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1 LIKE value_&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1 LIKE value__&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM table WHERE field1 LIKE value%&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// SUB QUERY</span>
<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/mysql_query"><span style="color: #990000;">mysql_query</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * table1 WHERE table2_id IN(SELECT table2_id FROM table2 WHERE data = data )&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div>
<h3>MySQL CONDITIONALS</h3>
<table class="tableBorder1px" style="1px solid #ccc;" border="0">
<tbody>
<tr>
<td width="110">=</td>
<td width="240">equals</td>
</tr>
<tr>
<td>&lt;</td>
<td>less than</td>
</tr>
<tr>
<td>&gt;</td>
<td>greater than</td>
</tr>
<tr>
<td>&lt;=</td>
<td>less than or equal to</td>
</tr>
<tr>
<td>&gt;=</td>
<td>greater than or equal to</td>
</tr>
<tr>
<td>!=</td>
<td>not equal to</td>
</tr>
<tr>
<td>IS NOT NULL</td>
<td>has any value</td>
</tr>
<tr>
<td>IS NULL</td>
<td>has no value at all</td>
</tr>
<tr>
<td>BETWEEN</td>
<td>within a specified range</td>
</tr>
<tr>
<td>NOT BETWEEN</td>
<td>outside a specified range</td>
</tr>
<tr>
<td>OR</td>
<td>one of two equations are true</td>
</tr>
<tr>
<td>||</td>
<td>same as OR</td>
</tr>
<tr>
<td>AND</td>
<td>both equations are true</td>
</tr>
<tr>
<td>&amp;&amp;</td>
<td>same as AND</td>
</tr>
<tr>
<td>NOT</td>
<td>both equations are false</td>
</tr>
<tr>
<td>!</td>
<td>same as NOT</td>
</tr>
</tbody>
</table>
<h3>MySQL COMPARISONS</h3>
<table class="tableBorder1px" style="width: 300px;" border="0">
<tbody>
<tr>
<td width="110">LIKE</td>
<td width="240">Simple pattern matching</td>
</tr>
<tr>
<td>NOT LIKE</td>
<td>Negation of simple pattern matching</td>
</tr>
<tr>
<td colspan="2">
<table class="tableBorder1px" style="margin-left: 10px; width: 340px;" border="0">
<tbody>
<tr>
<td width="50">%</td>
<td>Matches any number of characters, even zero characters</td>
</tr>
<tr>
<td>_</td>
<td>Matches exactly one character</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>STRCMP()</td>
<td>Compare two strings</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://eligeske.com/mysql/php-mysql-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
