# Can you use a variable within a LIKE query?

**URL:** <https://community.dreamfactory.com/t/can-you-use-a-variable-within-a-like-query/5128>\
**Category:** REST API\
**Created:** [February 20, 2020, 5:51pm UTC](https://community.dreamfactory.com/t/can-you-use-a-variable-within-a-like-query/5128 "2020-02-20T17:51:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![NatSo1](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@NatSo1](https://community.dreamfactory.com/u/NatSo1)\
**Post date:** [February 20, 2020, 5:51pm UTC](https://community.dreamfactory.com/t/can-you-use-a-variable-within-a-like-query/5128/1 "2020-02-20T17:51:37Z")

</div>

I’m using React, and I’m new to it. I want to have the items sort by last name (this works fine), and I want for the user to type into a search box the value of the variable query. This variable query will be used on the LIKE query.  
const searchURL= 'HiddenUrlHERE/\_table/FacultyInfo?order=facLastName%20ASC&filter=facLastname%20like%20%${query}%25`

When I look at the console, it says there’s no results returned.

This call is supposed to sort faculty by last name, then show the user faculty that match their search.  
I tried looking up the syntax for LIKE, but I could only find how to use like for a set string. What is the URL I should type? Thanks.

---

<div class="post-metadata">

**Author:** ![jason.gilmore](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@jason.gilmore](https://community.dreamfactory.com/u/jason.gilmore)\
**Post date:** [February 26, 2020, 10:31pm UTC](https://community.dreamfactory.com/t/can-you-use-a-variable-within-a-like-query/5128/2 "2020-02-26T22:31:37Z")

</div>

Hi,

You can definitely pass variables into your DreamFactory API queries. I’m by no means a React expert, but believe that because you’re using single quotes the variable will not interpolate. Instead you’ll want to use backticks to surround the `searchURL` variable. See this Stack Overflow post for more information:

> <https://stackoverflow.com/questions/37230555/get-with-query-string-with-fetch-in-react-native>
