I have a custom query that prints out fine.
This code prints out all the records
{exp:query limit="5" paginate="bottom" sql="SELECT commission_id,payment_id,receipt_id,product_id,affiliate_id,entry_date FROM exp_aff_commissions ORDER BY entry_date DESC"}when I try to limit the output to just the logged in member I used this statement
{exp:query limit="5" paginate="bottom" sql="SELECT commission_id,payment_id,receipt_id,product_id,affiliate_id,entry_date FROM exp_aff_commissions WHERE affiliate_id ='{member_id}' ORDER BY entry_date DESC"}This outputs nothing. The SQL statement would print out values if the value of member_id was merged into the statement.
I also tried this:
{assign_variable:sql_statement="SELECT commission_id,payment_id,receipt_id,product_id,affiliate_id,entry_date FROM exp_aff_commissions where affiliate_id ={member_id}"}
{exp:query limit="5" paginate="bottom" sql="{sql_statement} ORDER BY entry_date DESC"}That didn’t work either. I put {sql_statement} in the template to make sure that the SQL statement was correct, and it was.
Am I missing something, or can this not be done?
Thanks,
Jer