I’ve created a template who’s sole purpose is to look up an {entry_id} which varies depending on the channel.
The SQL Query which I’m running is very simple and returns the desired results when run in SequelPro but not when run in a browser.
$author = $this->EE->TMPL->embed_vars['embed:member'];
$channel = ($this->EE->TMPL->embed_vars['embed:datatype']=="member" ? 12 : 15);
$query = "SELECT entry_id FROM exp_channel_titles WHERE channel_id='".$channel."' AND author_id='".$author."'";
$results = $this->EE->db->query($query);This echo’s out the correct query but returns 0 results.
——
If I hard code the author_id then it returns the desired results:
$query = "SELECT entry_id FROM exp_channel_titles WHERE channel_id='12' AND author_id='25'";
$results = $this->EE->db->query($query);This echo’s out the the same query as the first one except with the desired result.