SoilentRed
Caaan do!
I have an element for start date, end date and a database join that gives a user id.
I have a fabrik table that with a bunch of data submitted by a user. I'm trying to put together a query that returns the row count of the selected user. I'm using calc with ajax to get the value.
Here's the code I'm tinkering with
And here's the error I'm getting
I've tried formatting the date with , for example $startDate = strtotime($start);
but any time I query the date range, this wants to break. Any ideas?
I have a fabrik table that with a bunch of data submitted by a user. I'm trying to put together a query that returns the row count of the selected user. I'm using calc with ajax to get the value.
Here's the code I'm tinkering with
Code:
$cbid = (int)'{afab_kpi_report___community_builder_raw}';
$start = '{afab_kpi_report___start_date}';
$end = '{afab_kpi_report___end_date}';
$db = JFactory::getDBO();
$db->setQuery('SELECT COUNT(*) FROM 07_new_member WHERE 07_new_member.agent_user_id = ' . $cbid . ' AND 07_new_member.date_time BETWEEN ' . $start . ',' . $end .'' );
$count = $db->loadResult();
return $count;
Code:
An error has occurred.
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
but any time I query the date range, this wants to break. Any ideas?