ontarget
Active Member
Hi I have created a form (only) with no list - the purpose of the form is to query a DB table
There are 3 fields
The form doesn't actually need to be submitted as i was planning to use Ajax in the "Output" calc element to show the result.
The calc element query works with hard values e.g see the WHERE statement
however when I substitute the values in the WHERE clause with the fabrik elements i get a 1054 error
"Unknown column '$category' in 'where clause' "
Do you know where I am going wrong?
Thanks
There are 3 fields
- Category (dropdown) {___select_category_raw}'
- Attended (dropdown) '{___attended_raw}'
- Output (calc)
The form doesn't actually need to be submitted as i was planning to use Ajax in the "Output" calc element to show the result.
The calc element query works with hard values e.g see the WHERE statement
PHP:
$category = '{___select_category_raw}';
$attended = '{___attended_raw}';
$year = '{___enter_year}';
$db =& JFactory::getDBO();
$db->setQuery('select count(*)
from aed_reg_list2 c
inner join nipd_eb_event_categories o
on c.event_id = o.event_id
WHERE o.category_id = 1 AND c.attended = 2 ');
return $db->loadResult();
however when I substitute the values in the WHERE clause with the fabrik elements i get a 1054 error
"Unknown column '$category' in 'where clause' "
PHP:
WHERE o.category_id = $category AND c.attended = $attended');
Do you know where I am going wrong?
Thanks