Alright, so this sounds like a weird question. I am using yahoo weather API, and discord.js to make a weather command. I use YQL and WOIED to try to have someone enter in their place they want to search up. Here is the variable search:
const query = new YQL(`SELECT * FROM weather.forecast WHERE woeid in (SELECT woeid FROM geo.places(1) WHERE text= ${place})`)
When I use the variable input though, it does not work, and will give me this error:
Cannot read property 'results' of undefined
Now, when I manually input the place I want to see, it works. Here is what I mean:
const query = new YQL(`SELECT * FROM weather.forecast WHERE woeid in (SELECT woeid FROM geo.places(1) WHERE text= "Broomfield, Co")`)
Note that I have my main emphasis on the WHERE text =
portion of each search query
Any help would be greatly appreciated!
Unless the variable you are inserting has double quotes as part of the string, you are going to have to insert them yourself in the format string. For example:
const query = new YQL(`SELECT * FROM weather.forecast WHERE woeid in (SELECT woeid FROM geo.places(1) WHERE text= "${place}")`)