I'm missing something stupid so I need another set of eyes.
I have a session value set that's a group concat of a few ids and I want to check to see if an id found by a query is in that group concat. The group concat variable is $session_unitidgrouping
The query doesn't return errors, but it doesn't return what I'd expect either. It returns nothing at all.
For instance, I have data where unit_id = 3 and $session_unitidgrouping = 3, 1, but it returns nothing.
Does anyone have any ideas?
CREATE TABLE IF NOT EXISTS `meetings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`meetingleader_id` int(11) NOT NULL,
`unit_id` int(11) NOT NULL,
`status_id` int(11) NOT NULL,
`meeting_date` datetime NOT NULL,
`type` varchar(50) NOT NULL,
`length` varchar(50) NOT NULL,
`agenda` varchar(1000) NOT NULL,
`minutes` varchar(1000) NOT NULL,
`notes` varchar(1000) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=101 ;
This is the query I'm using to simplify things during testing.
$query="select meetings.meeting_date, meetings.unit_id as unitid
from meetings
where meetings.status_id = '20' and '$session_unitidgrouping' LIKE '%meetings.unit_id%'
Order by meetings.meeting_date asc";
confirm_query($query);
$result=mysql_query($query, $connection);
$num=mysql_numrows($result);
If I do something like this it works fine
select meetings.meeting_date, meetings.unit_id as unitid
from meetings
where meetings.status_id = '20' and '3, 1' LIKE '%3%'
Order by meetings.meeting_date asc