<?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>Kevin Pajak - Interactive Web Developer/Designer - BLOG &#187; mysql</title>
	<atom:link href="http://www.kevinpajak.com/blog/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kevinpajak.com/blog</link>
	<description>Creative visionary, digital entrepreneur.</description>
	<lastBuildDate>Tue, 13 Apr 2010 02:01:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to replace a backslash character in a string</title>
		<link>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 08:36:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=363</guid>
		<description><![CDATA[Ah, so often it&#8217;s the little things eh&#8230; PROBLEM: I needed to find a way to &#8220;re-process&#8221; text a user enters for a live chat client I&#8217;m working on (in which I prevented MySQL database injections via the mysqli_real_escape_string function). The problem of course is that the text the user enters nicely protects you from [...]]]></description>
			<content:encoded><![CDATA[<p>Ah, so often it&#8217;s the little things eh&#8230;</p>
<p>PROBLEM: I needed to find a way to &#8220;re-process&#8221; text a user enters for a live chat client I&#8217;m working on (in which I prevented MySQL database injections via the <em>mysqli_real_escape_string</em> function). The problem of course is that the text the user enters nicely protects you from a MySQL database injection, BUT the text then comes back full of backslash (\) characters (not too cool looking huh). So, to remove these, you can use the following code (here, I use the PHP <em>str_replace</em> function:</p>
<p>// Convert escaped characters back to regular text<br />
$string = str_replace(&quot;\\&quot;, &quot;&quot;, $string);</p>
<p>Thanks to Geoff Muldoon for this one!:<br />
<A HREF="http://www.bigresource.com/Tracker/Track-php-OcMaOirM/" target="_blank"><B>How to replace a backslash character in a string?</B></A></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/12/how-to-replace-a-backslash-character-in-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysqli_real_escape requires TWO parameters!</title>
		<link>http://www.kevinpajak.com/blog/2010/02/11/mysqli_real_escape-requires-two-parameters/</link>
		<comments>http://www.kevinpajak.com/blog/2010/02/11/mysqli_real_escape-requires-two-parameters/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 08:27:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Dev/Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.kevinpajak.com/blog/?p=356</guid>
		<description><![CDATA[Props to this really useful post on PHPFreaks.com: http://www.phpfreaks.com/forums/index.php?topic=219045.0 I was having some issues with a mysqli_real_escape_string function that I had converted from mysql to mysqli I believe that the mere mysql version of this tag can function with just a $value, but the mysqli version requires TWO PARAMETERS: both the $connection variable, and the [...]]]></description>
			<content:encoded><![CDATA[<p>Props to this really useful post on PHPFreaks.com:<br />
<A HREF="http://www.phpfreaks.com/forums/index.php?topic=219045.0" target="_blank">http://www.phpfreaks.com/forums/index.php?topic=219045.0</A></p>
<p>I was having some issues with a mysqli_real_escape_string function that I had converted from mysql to <em>mysqli</em> I believe that the mere mysql version of this tag can function with just a <b>$value</b>, but the mysqli version requires TWO PARAMETERS: both the $connection variable, and the $string (whatever variable your particular function uses. The one I have here goes through all posts in a foreach statement and escapes the values of all posts using an array (to prevent MySQL injections).</p>
<p>Ex:<br />
  //This stops SQL Injection in POST vars<br />
  foreach ($_POST as $key =&gt; $value) {<br />
    $_POST[$key] = mysqli_real_escape_string($connection, $value);<br />
  }</p>
<p>$connection = whichever variable you would normally use to reference connection to your MySQL database(s).</p>
<p><A HREF="http://www.phpfreaks.com/forums/index.php?topic=219045.0" target="_blank"><B>THIS POST</B></A> solved my problem! (Thanks a lot Bendude14!)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinpajak.com/blog/2010/02/11/mysqli_real_escape-requires-two-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
