Try this: db_query('SET @select_ip="%s"', db_escape_string($ip)); db_query('SELECT name, id, lft, rgt FROM resubmt_skill_ids AS node WHERE ( node.name LIKE CONCAT_WS( "", "%%", @select_ip, "%%" )") ORDER BY node.lft') Liviu. On Fri, May 20, 2011 at 4:46 AM, Ms. Nancy Wichmann <nan_wich@bellsouth.net> wrote:
The problem is not the "s." You wanted a "%" to be in the query. The corrects way to do that, as the API doc states, is with "%%". That's why it worked when you changed it.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Austin Einter
str = SELECT name, id, lft, rgt FROM resubmt_skill_ids AS node WHERE ( node.name LIKE "%sip%") ORDER BY node.lft
On debugging, looks the query went as SELECT name, id, lft, rgt FROM resubmt_skill_ids AS node WHERE ( node.name LIKE "ip%") ORDER BY node.lft
Then I changed the query to
SELECT name, id, lft, rgt FROM resubmt_skill_ids AS node WHERE ( node.name LIKE "%%sip%") ORDER BY node.lft Above query returns expected records.
My question is , when a token starts with "s", we will be facing above issue. What is the best way to resolve it.
-- [ Drupal support list | http://lists.drupal.org/ ]
-- regards, mit freundlichen Grüßen, cu stima, Liviu Nicolicioiu Chief Technichal Officer ______________________________ epoint - consulting + development Vacarescu 7 300182 Timisoara Romania email: liviu.nicolicioiu@epoint.ro skype: nicolicioiu.liviu mobile: +40 / 745/ 560 322 fax: +40 / 256 / 407 147 www.epoint.ro "reliable solutions. delivered." ______________________________ This message and any attached files are confidential and intended solely for the addressee(s). Any publication, transmission or other use of the information by a person or entity other than the intended addressee is prohibited. If you receive this in error please contact the sender and delete the material. The sender does not accept liability for any errors or omissions as a result of the transmission.