<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Austin,<br>
<br>
The only time you need to escape a character in a string, is when it
would otherwise be miss interpreted. When you begin a string with a
' or a ", PHP will identify the next ' or " as the end of the
string, as long as it matches the first character. In other words
beginning a string with a ' will cause PHP to expect the next ' to
mark the end of the string (same matching on the " character, if
that's what you started with). If you begin your string with a '
(single quote) you can code as many " (double quotes) as you want
between the first and end string character without having to escape
them (\ character), conversely if you begin your string with "
(double quote) you can use as many single quotes as you want between
them.<br>
<br>
If you find yourself having to begin a string with a double quote
and you absolutely need to imbed a double quote in the middle of the
string and don't want it to be miss interpreted as the end of the
string simply precede it with the backslash, to escape it from being
miss interpreted as the end of string.<br>
<br>
On another note, the SQL language used by databases is not PHP, so
to place SQL syntax in your program so that you can pass it to the
SQL server, you should place it in a string. In this case, as you
would suspect, your string should begin and end with a single quote
or a double quote.<br>
<br>
hope this helps,<br>
<br>
Warren Vail<br>
<br>
On 4/10/2011 5:23 PM, Austin Einter wrote:
<blockquote
cite="mid:BANLkTinqt4hYkYq-0oAeH9NoJbJpYWnP5A@mail.gmail.com"
type="cite">
<div>Hi </div>
<div>I have a below string.</div>
<div><strong>PHP, HTML, SQL</strong></div>
<div>Want to convert it to</div>
<div><strong>'PHP', 'HTML', 'SQL'</strong></div>
<div> </div>
<div>I tried to write a function to do it as below. If I print the
function output it prints properly.</div>
<div>If same function output I use for SQL query as below I get
warning.</div>
<div> </div>
<div>Query: SELECT skillid FROM {resubmt_skills} WHERE
resubmt_skills.skillname IN (%s)", $fSkill</div>
<div><font color="#ff0000">Warning: SELECT skillid FROM
resubmt_skills WHERE resubmt_skills.skillname IN (\'ITI\',\'
PHP\'))) in
C:\MyWeb6.20\wamp\www\livejobs1\sites\default\modules\resume_search\resume_search.module
on line 140.</font></div>
<div> </div>
<div>Looks it has extra forward slashes. How can I overcome this.</div>
<div> </div>
<div>Thanks</div>
<div>Austin</div>
<div> </div>
<div> </div>
<div> </div>
</blockquote>
<br>
</body>
</html>