<?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>anupsaund &#187; PHP</title>
	<atom:link href="http://www.anupsaund.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anupsaund.com</link>
	<description>... thoughts from a Web Developer.</description>
	<lastBuildDate>Tue, 11 May 2010 13:36:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Stripslashes in SQL for MYSQL and ORACLE</title>
		<link>http://www.anupsaund.com/2010/04/28/stripslashes-in-sql-for-mysql-and-oracle/</link>
		<comments>http://www.anupsaund.com/2010/04/28/stripslashes-in-sql-for-mysql-and-oracle/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 10:07:55 +0000</pubDate>
		<dc:creator>Anup Saund</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.anupsaund.com/?p=44</guid>
		<description><![CDATA[Problem
Today, I wanted to strip slashes from a comment field using SQL (INSTEAD of using php stripslashes).
Why you ask?
I was working on an application which had not considered stripslashes for formatting output.
So I had a look and realised. Do I change 40,000 lines of code to add Stripslashes, or 1 line at the SQL select [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>Today, I wanted to strip slashes from a comment field using SQL (INSTEAD of using php stripslashes).</p>
<p>Why you ask?</p>
<p>I was working on an application which had not considered stripslashes for formatting output.</p>
<p>So I had a look and realised. Do I change 40,000 lines of code to add Stripslashes, or 1 line at the SQL select statement?</p>
<p>OK, slight exaggeration, but you get what I mean.</p>
<p><strong>Solution</strong></p>
<p>MySQL</p>
<pre class="brush: sql">
Select
  Replace(field_name, &#039;\\&#039;, &#039;&#039;) as stripped_field
from
  table;
</pre>
<p>Oracle</p>
<pre class="brush: sql">
Select
  Replace(field_name, &#039;\&#039;, &#039;&#039;) as stripped_field
from
  table;
</pre>
<p><strong>PHP<em> EXTRA</em></strong></p>
<p><em>If using in PHP add an extra backslash like this;</em></p>
<pre class="brush: sql">
// strip slashes as part of the SQL select statement
$sql = &quot;Select Replace(field_name, &#039;\\\&#039;, &#039;&#039;) as stripped_field from table&quot;;
</pre>
<p><em>Please get in touch if you know of an easier way to do this, for example, Oracle Functions, or MySQL functions.</em></p>
<p><em>Many thanks and happy coding.<br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anupsaund.com/2010/04/28/stripslashes-in-sql-for-mysql-and-oracle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PRE tags, the quick way to keep formatting</title>
		<link>http://www.anupsaund.com/2010/03/01/pre-tags-the-quick-way-to-keep-formatting/</link>
		<comments>http://www.anupsaund.com/2010/03/01/pre-tags-the-quick-way-to-keep-formatting/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 22:21:28 +0000</pubDate>
		<dc:creator>Anup Saund</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anupsaund.com/?p=35</guid>
		<description><![CDATA[I get asked quite often if there is a way to show CODE on a website, with it&#8217;s formatting in place?
The short answer is &#60;pre&#62;
It can output free text (i.e. non server side code) in a pre-formatted way. Yep, PRE = Pre-formatted.
On top of that, Preformatted also renders the php print_r() output in a nicely [...]]]></description>
			<content:encoded><![CDATA[<p>I get asked quite often if there is a way to show CODE on a website, with it&#8217;s formatting in place?</p>
<p>The short answer is &lt;pre&gt;</p>
<p>It can output free text (i.e. non server side code) in a pre-formatted way. Yep, PRE = Pre-formatted.</p>
<p>On top of that, Preformatted also renders the php print_r() output in a nicely nested unordered list, which is great for debug purposes;</p>
<p>e.g. </p>
<pre class="brush: php">  echo &quot;&lt;pre&gt;&quot;;    print_r($arr);  echo &quot;&lt;/pre&gt;&quot;; </pre>
<p>I am sure there are other uses for the &lt;pre&gt; tag too, I have just scratched the surface.</p>
<p>Give it a go &#8211; let me know if you find other uses for it.</p>
<p>Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anupsaund.com/2010/03/01/pre-tags-the-quick-way-to-keep-formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet Explorer 7 &#8211; Accessibility Options</title>
		<link>http://www.anupsaund.com/2008/11/23/internet-explorer-7-accessibility-options/</link>
		<comments>http://www.anupsaund.com/2008/11/23/internet-explorer-7-accessibility-options/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 00:05:49 +0000</pubDate>
		<dc:creator>Anup Saund</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anupsaund.com/internet-explorer-7-accessibility-options</guid>
		<description><![CDATA[These settings are a web developers worst nightmare&#8230;. what happens if a web browser ignores the website FONTS? or worst still the STYLESHEETS?
Well &#8211; i guess if the website is built with accessibilty in mind, then there is no problem;
The page will render correct, no matter what browser or platform&#8230; but&#8230; if you have to [...]]]></description>
			<content:encoded><![CDATA[<p>These settings are a web developers worst nightmare&#8230;. what happens if a web browser ignores the website FONTS? or worst still the STYLESHEETS?</p>
<p>Well &#8211; i guess if the website is built with accessibilty in mind, then there is no problem;</p>
<p>The page will render correct, no matter what browser or platform&#8230; but&#8230; if you have to use absolute positioning, and specific font sizes&#8230; then please please bear these settings in mind.</p>
<p><img align="middle" alt="IE7 Accessibility Options" title="IE7 Accessibility Options" src="http://www.anupsaund.com/images/accessibility_options.gif" /></p>
<p>Tools | Internet Options | Accessibility.</p>
<p>Happy coding people!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anupsaund.com/2008/11/23/internet-explorer-7-accessibility-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Split a Price (FLOAT) into Pounds (£) and Pence (p)</title>
		<link>http://www.anupsaund.com/2008/04/22/split-a-price-float-into-pounds-and-pence-p/</link>
		<comments>http://www.anupsaund.com/2008/04/22/split-a-price-float-into-pounds-and-pence-p/#comments</comments>
		<pubDate>Tue, 22 Apr 2008 21:37:52 +0000</pubDate>
		<dc:creator>Anup Saund</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anupsaund.com/split-a-price-float-into-pounds-and-pence-p</guid>
		<description><![CDATA[Whilst working on an E-commerce website, written in PHP i came across and issue where i had a price stored in a table as a float.
I wanted to split the pounds, and pence into two variables to make it easier to work with, but then save the results back into 1 field. So this is [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst working on an E-commerce website, written in PHP i came across and issue where i had a price stored in a table as a float.</p>
<p>I wanted to split the pounds, and pence into two variables to make it easier to work with, but then save the results back into 1 field. So this is what i did.</p>
<p><a title="PHP Explode Function" href="http://uk2.php.net/manual/en/function.explode.php#63110">http://uk2.php.net/manual/en/function.explode.php#63110</a></p>
<pre class="brush: php">
//If you want to split a price (float) into pounds and pence.
//or dollors and cents etc etc.

$price = &quot;6.20&quot;;

$split = explode(&quot;.&quot;, $price);
$pound = $split[0]; // piece1
$pence = $split[1]; // piece2

echo &quot;&amp;pound $pound . $pence\n&quot;;&lt;/span&gt;&lt;/code&gt;
</pre>
<p>Enjoy <img src='http://www.anupsaund.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.anupsaund.com/2008/04/22/split-a-price-float-into-pounds-and-pence-p/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Website Copyright Date</title>
		<link>http://www.anupsaund.com/2007/02/22/website-copyright-date/</link>
		<comments>http://www.anupsaund.com/2007/02/22/website-copyright-date/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 17:05:52 +0000</pubDate>
		<dc:creator>Anup Saund</dc:creator>
				<category><![CDATA[ASP]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anupsaund.com/?p=8</guid>
		<description><![CDATA[Have you noticed that some websites have a copyright date which is wrong?
For example:
www.somecompany.com (I appologise if you own this site)
then on the site, you have, Copyright SomeCompany Ltd 2002-2006
Now, if your lucky, your site is designed so that the footer can be changed once, so the entire site is updated. Well done.
For the others&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Have you noticed that some websites have a copyright date which is wrong?</p>
<p>For example:</p>
<p>www.somecompany.com (I appologise if you own this site)</p>
<p>then on the site, you have, Copyright SomeCompany Ltd 2002-2006</p>
<p>Now, if your lucky, your site is designed so that the footer can be changed once, so the entire site is updated. Well done.<br />
For the others&#8230; shame on you. &#8211; Redesign your site.</p>
<p>Anyway.. heres a way to crack it on the head once and for all.</p>
<pre class="brush: php">
//PHP
2003 - &lt; ?php echo date(&quot;Y&quot;); ?&gt;
</pre>
<pre class="brush: php">
//ASP
2003 - &lt; %= year %&gt;
</pre>
<p>This way, as long as your server date is correct, your website will always be up to date. In fact, consider using date more in this way, to save yourself manual intervention.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anupsaund.com/2007/02/22/website-copyright-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
