Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Drupal - Using LIKE in db_query in D7

Try this.

 $sql = 'SELECT sid, score FROM {search_index} WHERE word LIKE :term';
 $result = db_query($sql, array(':term' => '%' . db_like($search_term)));

Tags:

Database

7

Related

Drupal - How to programmatically update the allowed values of a list field? Drupal - Determine whether module is enabled / disabled Drupal - How to use [submission:values] in Email template in Webforms Drupal - Memory-saving cache-clearing strategies for large sites? Drupal - "The website encountered an unexpected error. Please try again later." Drupal - How can I force users to provide a reason when cancelling their accounts? Drupal - Right way to update a drupal distribution? Drupal - How to delete cache after updating/deleting/adding new content using hooks? Drupal - Disable editing of a node after it has been published Drupal - What is the purpose of Views "Attachment", "Content pane" & "Context"? Drupal - Get a list of all users and into an array Drupal - Loading a views block inside another block

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy