<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1040690" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1040690</link>
    <description></description>
    <language>en</language>
          <item>
    <title>That&#039;s cleared a lot up,</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228658</link>
    <description> &lt;p&gt;That&#039;s cleared a lot up, thanks!&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;JeevesBond wrote:&lt;/strong&gt; Tutorials on the Web are fine, but they rarely teach good architecture (way beyond their scope).&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That&#039;s why I come here  &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 20 Feb 2008 17:06:17 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1228658 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>greg wrote:

hmm, that&#039;s</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228637</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;greg wrote:&lt;/strong&gt; hmm, that&#039;s interesting.&lt;/p&gt;
&lt;p&gt;I see all tutorials on the net (decent sites too) that use the real_escape first, then make a query to the DB.&lt;br /&gt;
So they run the variable through real_escape, then use the var in the query as normal.&lt;/p&gt;
&lt;p&gt;$value = mysql_real_escape_string($value);&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That&#039;s how I do it.  It&#039;s not after you query the database.  You just have to be connected to the database.&lt;/p&gt;
&lt;p&gt;For example, it&#039;s something like this:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mysql_connect&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;localhost&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;user&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;pass&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;db_name&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;/* now that we have a db selected, we can use mysql_real_escape_string() */&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$user &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_real_escape_string&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;user&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$password &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_real_escape_string&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;password&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$query &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;SELECT * FROM Users WHERE user = &#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039; &amp;amp;&amp;amp; password = &#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039; LIMIT 1&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$result &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;/* do some results processing here */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 19 Feb 2008 19:19:31 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228637 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>&lt;?php
$query =</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228634</link>
    <description> &lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$query &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;sprintf&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;INSERT INTO products (`name`) VALUES (&#039;%s&#039;, &#039;%s&#039;, %d)&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_real_escape_string&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$product_name&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Drupal does it this way. Don&#039;t think it matters though to be honest, just use whichever method you&#039;re most likely to remember to implement. In fact the best method is the Drupal way: use a thin database abstraction layer to do it all for you. Have a look at the &lt;a href=&quot;http://api.drupal.org/api/function/db_query/6&quot;&gt;db_query()&lt;/a&gt; function. If you implement something like that and run &lt;em&gt;all&lt;/em&gt; queries through one function it will be nearly impossible to introduce a SQL injection vulnerability.&lt;/p&gt;
&lt;p&gt;Tutorials on the Web are fine, but they rarely teach good architecture (way beyond their scope).&lt;/p&gt;
 </description>
     <pubDate>Tue, 19 Feb 2008 18:37:37 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1228634 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>hmm, that&#039;s interesting.
I</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228619</link>
    <description> &lt;p&gt;hmm, that&#039;s interesting.&lt;/p&gt;
&lt;p&gt;I see all tutorials on the net (decent sites too) that use the real_escape first, then make a query to the DB.&lt;br /&gt;
So they run the variable through real_escape, then use the var in the query as normal.&lt;/p&gt;
&lt;p&gt;$value = mysql_real_escape_string($value);&lt;/p&gt;
&lt;p&gt;Yet on php.net they use the real_escape in the query line, and that is the ONLY site I have seen do it that way&lt;/p&gt;
&lt;p&gt;$query = sprintf(&quot;INSERT INTO products (`name`) VALUES (&#039;%s&#039;, &#039;%s&#039;, %d)&quot;,&lt;br /&gt;
                    mysql_real_escape_string($product_name));&lt;/p&gt;
&lt;p&gt;So is one way better than the other?&lt;/p&gt;
 </description>
     <pubDate>Tue, 19 Feb 2008 05:31:12 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1228619 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>greg</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228617</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;greg wrote:&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;EDIT&lt;br /&gt;
pr0gr4mm3r, when I try the above code you did with strlen, the first one outputs 38 but the second one after the real_escape outputs 0&lt;br /&gt;
Why is that?&lt;/p&gt;
&lt;p&gt;EDIT II&lt;br /&gt;
I tried with mysql_escape_string instead and it works fine. So the server I am using doesn&#039;t have PHP version that has real_escape?&lt;br /&gt;
According to my admin CP, it&#039;s running version 5.2.5&lt;br /&gt;
 &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/confused.png&quot; title=&quot;Confused&quot; alt=&quot;Confused&quot; class=&quot;smiley-content&quot; /&gt; &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;You have to initiate a connection to the database before you run mysql_real_escape_string() because it escapes the string according to the character set of the database.  I took out the lines that connected to the database before I posted the code because it has the password, hostname, etc.  Sorry, I probably should have mentioned that.  The mysql_escape_string() does not require an active connection to a database, so that&#039;s probably why it worked for you while the real_escape one didn&#039;t.&lt;/p&gt;
&lt;p&gt;This was a good question - something I never thought of.&lt;/p&gt;
 </description>
     <pubDate>Tue, 19 Feb 2008 04:52:25 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228617 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Right.
So the real_escape</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228615</link>
    <description> &lt;p&gt;Right.&lt;br /&gt;
So the real_escape backslash simply tells mysql that the apostrophe (or slash or quotes etc)is simply a character being entered into the DB as text, and not to use it as whatever the apostrophe would be used for within a PHP/MYSQL query. I.E. as part of PHP syntax.&lt;/p&gt;
&lt;p&gt;And so that is why it&#039;s not actually entered into the DB, it doesn&#039;t need to be as the only injection issues are at the time of query excecution.&lt;br /&gt;
The real_esacpe takes out the problem of that by using the chars as text only rather than allowing them to change the structure of a query and thus not needed to be stored in the DB&lt;/p&gt;
&lt;p&gt;Interesting test too pr0gr4mm3r!&lt;br /&gt;
Thanks to you both!&lt;/p&gt;
&lt;p&gt;EDIT&lt;br /&gt;
pr0gr4mm3r, when I try the above code you did with strlen, the first one outputs 38 but the second one after the real_escape outputs 0&lt;br /&gt;
Why is that?&lt;/p&gt;
&lt;p&gt;EDIT II&lt;br /&gt;
I tried with mysql_escape_string instead and it works fine. So the server I am using doesn&#039;t have PHP version that has real_escape?&lt;br /&gt;
According to my admin CP, it&#039;s running version 5.2.5&lt;br /&gt;
 &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/confused.png&quot; title=&quot;Confused&quot; alt=&quot;Confused&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 19 Feb 2008 03:22:00 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1228615 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>JeevesBond wrote:

We&#039;d need</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228610</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;JeevesBond wrote:&lt;/strong&gt; We&#039;d need to test against inserting the field into a MySQL record, &lt;code&gt;SELECT&lt;/code&gt; it out again, &lt;em&gt;then&lt;/em&gt; test the length. As you saw it didn&#039;t truncate in the database. Good test. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That&#039;s probably a good idea.  I&#039;ve been looking in phpMyAdmin, and that might be taking out the slashes automatically.  I ran some more queries, but this time selected the data myself.  See the attached screenshot.  In the top section, I show the length of the string, and the length of the escaped string.  Then, once that it inserted into the DB, I select it again showing the length and the string.  This shows that the backslash is not stored in the DB, thus not making that an issue with the limited field lengths. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Edit: Forgot to mention that the field is a varchar type with a max length of 15.&lt;/p&gt;
 </description>
     <pubDate>Mon, 18 Feb 2008 20:04:27 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228610 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The backslash shouldn&#039;t add</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228608</link>
    <description> &lt;blockquote&gt;&lt;p&gt;The backslash shouldn&#039;t add length to the string because the backslash isn&#039;t a character. From my understanding, it just tells PHP to take the next character literally.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That makes a lot of sense. Maybe we&#039;re missing something though: the backslash doesn&#039;t tell PHP to take the next character literally, it tell &lt;em&gt;MySQL&lt;/em&gt; to take the next character literally.&lt;/p&gt;
&lt;p&gt;We&#039;d need to test against inserting the field into a MySQL record, &lt;code&gt;SELECT&lt;/code&gt; it out again, &lt;em&gt;then&lt;/em&gt; test the length. As you saw it didn&#039;t truncate in the database. Good test. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 18 Feb 2008 13:39:42 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1228608 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>The backslash shouldn&#039;t add</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228603</link>
    <description> &lt;p&gt;The backslash shouldn&#039;t add length to the string because the backslash isn&#039;t a character.  From my understanding, it just tells PHP to take the next character literally.  Unfortunately, the following code did not support that theory:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $str &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;Here&#039;s is a test string with some &#039;&#039;&#039;.&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$strlen1 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$strlen2 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_real_escape_string&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$strlen1 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;. &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;&amp;lt;br /&amp;gt;&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// returns 38&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;echo &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$strlen2 &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;. &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;&amp;lt;br /&amp;gt;&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;// returns 42!&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Even though PHP sees it at a different length, I tried it in a test db to see if MySQL sees it as a different length as well.  I made a varchar field with a length of 5, and put in an escaped string of &quot;ab&#039;cd&quot;.  It was all there and not truncated to &quot;ac\&#039;d&quot;.&lt;/p&gt;
&lt;p&gt;So from what I did, escaping a string &lt;em&gt;will&lt;/em&gt; make it larger as far as PHP is concerned, but it &lt;em&gt;will not&lt;/em&gt; make the string too large for the DB fields.&lt;/p&gt;
 </description>
     <pubDate>Mon, 18 Feb 2008 01:56:11 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1228603 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>I know it does slashes, but</title>
    <link>https://www.webmaster-forums.net/web-database-development/mysql-real-escape-string#comment-1228591</link>
    <description> &lt;blockquote&gt;&lt;p&gt;I know it does slashes, but why does php.net not list them?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;It does. You just need to look carefully at the list to see it. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Also, what about mysql field lengths? If you create a row with say varchar(18) and are expecting at most 18, and real_escape adds slashes, I presume it counts in the total chars allowed. So am I to create field lengths with potential additional chars for the slashes from real_escape?&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;That&#039;s an interesting point. Although I think this isn&#039;t a big issue, usually fields of restricted size don&#039;t require double or single quotes, null characters etc. Think you&#039;re right though, and this could happen, doesn&#039;t seem too many people are worried about it though!&lt;/p&gt;
&lt;p&gt;They should include it in the PHP documentation though, that would be handy.&lt;/p&gt;
 </description>
     <pubDate>Sun, 17 Feb 2008 12:43:08 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1228591 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
