This syntax is a hold over from the old C programming language and I have seen several of the newer Drupal books recommending it, not sure if there is a preference in D7. but essentially what nan wich (intrigued by the name) says is correct, if you build your query string it (as should all strings) begin with a single or double quote and end with the same. I personally can't see any problem coding multiple %s and %d placeholders in one string then coding them as a list of variables, but don't forget that your string and list need to be passed to a function (fscanf comes to mind), but I believe the new drupal get db functions (sorry I don't remember their names) do this.
Warren Vail
On 4/10/2011 5:55 PM, Austin Einter wrote:
When we do a SQL query, if we want to pass value to query, we make use %d for integers or %s for strings. Similarly do we have any place holders for arrays. 2. I am facing a below typical problem, can somebody tell me what should I do? Below query works fine. SELECT skillid FROM {resubmt_skills} WHERE resubmt_skills.skillname IN (*'PHP', 'HTML', 'SQL'*) But in above query search string *'PHP', 'HTML', 'SQL' *is hard coded. I want to make the query generic. Lets say in custom search form, user entered search string PHP, Telecom, HTML,, so how can I write a generic query. Thanks Austin