In SQL you have to double the single quotes.<br><br>update FOO set X = 'This couldn''t happen to you'<br><br>of course there'a method in Perl to do it, as Keith<br>mentioned.<br><span class="sg"><br>JD</span><div><span class="e" id="q_10e0f46e729d742b_2">
<br><br><div><span class="gmail_quote">
On 10/3/06, <b class="gmail_sendername">Keith Reed</b> &lt;<a href="mailto:keith.reed@philips.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">keith.reed@philips.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<br><font face="sans-serif" size="2">Check out dbh-&gt;quote()</font>
<br>
<br><font face="sans-serif" size="2">Keith</font>
<br>
<br>
<br>
<table width="100%">
<tbody><tr valign="top">
<td width="33%">
<br>
<br>
<br>
<br>
<br><font face="sans-serif" size="1"><b>&quot;luis medrano&quot; &lt;<a href="mailto:lmzaldivar@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">lmzaldivar@gmail.com</a>&gt;</b>
</font>
<p><font face="sans-serif" size="1">Sent by:</font>
<br><font face="sans-serif" size="1">spug-list-bounces+keith.reed=<a href="mailto:philips.com@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">philips.com@pm.org</a></font>
</p><p><font face="sans-serif" size="1">2006-10-03 10:35 AM</font>
</p></td><td width="66%">
<table width="100%">
<tbody><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">To</font></div>
</td><td><font face="sans-serif" size="1"><a href="mailto:spug-list@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">spug-list@pm.org</a></font>
</td></tr><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">cc</font></div>
</td><td>
<br></td></tr><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">Subject</font></div>
</td><td><font face="sans-serif" size="1">SPUG: inserting content into mysql database</font>
</td></tr><tr>
<td>
<div align="right"><font face="sans-serif" size="1">Classification</font></div>
</td><td><br></td></tr></tbody></table>
<br>
<table>
<tbody><tr valign="top">
<td>
<br></td><td><br></td></tr></tbody></table>
<div align="right">
<br></div></td></tr></tbody></table>
<br>
<br>
<br><font size="3"></font><div><span><font size="3">List,<br>
<br>
I running this code feeding a database:<br>
my $sth1=$dbh-&gt;prepare(&quot;INSERT INTO wp_posts(post_author, post_date,
post_date_gmt, post_content,post_title, post_status, comment_status, ping_status,post_name,
post_modified, post_modified_gmt,guid) <br>
 &nbsp; &nbsp; &nbsp; VALUES('$post_author','$post_date','$post_date_gmt','@post_content','$post_title','$post_status','$comment_status','$ping_status','$post_name','$post_modified','$post_modified_gmt','$guid')&quot;)
&nbsp;or die; # &quot;Couldnt prepare statement: &quot; . dbh-&gt;errstr;
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;my $rv1 = $sth1-&gt;execute();<br>
<br>
<br>
but my problem is if any of the values of @post_content or $post_title
contain apostrophe the script show this error not executing of feeding
the database: <br>
<br>
DBD::mysql::st execute failed: You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server version for the right
syntax to use near 's%20secret%20visits%20to%20heiress/article.do&quot;&gt;Goldsmith
s secret visits to heir ' at line 2 at posting-news.pl<br>
<br>
anybody knows how can I fix this without removing the apostrophe?<br>
<br>
Thanks,<br></font></span></div>
<font size="3">Luis</font><font size="2"><tt>_____________________________________________________________<br>
Seattle Perl Users Group Mailing List &nbsp;<br>
 &nbsp; &nbsp; POST TO: <a href="mailto:spug-list@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">spug-list@pm.org</a><br>
SUBSCRIPTION: <a href="http://mail.pm.org/mailman/listinfo/spug-list" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.pm.org/mailman/listinfo/spug-list</a><br>
 &nbsp; &nbsp;MEETINGS: 3rd Tuesdays<br>
 &nbsp; &nbsp;WEB PAGE: <a href="http://seattleperl.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://seattleperl.org/</a></tt></font>
<br>
<br>_____________________________________________________________<br>Seattle Perl Users Group Mailing List<br> &nbsp; &nbsp; POST TO: <a href="mailto:spug-list@pm.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
spug-list@pm.org
</a><br>SUBSCRIPTION: <a href="http://mail.pm.org/mailman/listinfo/spug-list" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.pm.org/mailman/listinfo/spug-list</a><br> &nbsp; &nbsp;MEETINGS: 3rd Tuesdays
<br> &nbsp; &nbsp;WEB PAGE: <a href="http://seattleperl.org/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://seattleperl.org/</a><br><br></blockquote></div><br>

</span></div>