<div>Thanks Warren, Pierre</div>
<div>I got it working with place hoolders.<br></div>
<div>Best Regards</div>
<div>Austin</div>
<div><br> </div>
<div class="gmail_quote">On Mon, Apr 11, 2011 at 10:35 AM, Warren Vail <span dir="ltr"><<a href="mailto:warren@vailtech.net">warren@vailtech.net</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Not sure what you mean by generic, and never used the db_placeholders<br>function, but this should work;<br>
<br>$skillnames = array("PHP", "HTML","SQL");<br>$tblname = "resubmt_skills";<br>$query = sprintf("SELECT skillid FROM %s WHERE skillname in ('%s')",<br>$tblname, "'".implode("', '",$skillnames)."'");<br>
//execute and fetch query results here<br><br>not real elegant, but nothing is as elegant as the solution that works<br>and maintainers can understand.<br><font color="#888888"><br>Warren Vail<br></font>
<div class="im"><br>On 4/10/2011 6:33 PM, Greg Knaddison wrote:<br>> On Sun, Apr 10, 2011 at 6:55 PM, Austin Einter<<a href="mailto:austin.einter@gmail.com">austin.einter@gmail.com</a>> wrote:<br>>> 2.<br>
>> I am facing a below typical problem, can somebody tell me what should I do?<br>>><br>>> Below query works fine.<br>>> SELECT skillid FROM {resubmt_skills} WHERE resubmt_skills.skillname IN<br>>> ('PHP', 'HTML', 'SQL')<br>
>><br>>> But in above query search string 'PHP', 'HTML', 'SQL' is hard coded.<br>>> I want to make the query generic.<br>>><br>>> Lets say in custom search form, user entered search string PHP, Telecom,<br>
>> HTML,, so how can I write a generic query.<br>>><br>> There's a handy function you need called db_placeholders -<br>><br>> <a href="http://api.drupal.org/api/drupal/includes--database.inc/function/db_placeholders/6" target="_blank">http://api.drupal.org/api/drupal/includes--database.inc/function/db_placeholders/6</a><br>
><br>> There are some examples on that page, but if you want more help be<br>> sure to provide more of your example code.<br>><br>> Cheers,<br>> Greg<br>><br>><br><br>--<br></div>
<div>
<div></div>
<div class="h5">[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></div></div></blockquote></div><br>