I'm trying to create a select box drop down with a twist,
Basically this is an Ajax form that when an item is selected from the list it'll add it into a text field. However I also want to add a few extra selections in here.
the string I'm getting is made up of COMPANY
_
SITE
_
DEPARTMENT
and for example SDGCC_NEWTOWN_INBOUND
.
Using PHP I wish to take every item from the database in the logintags table which could contain multiple COMPANY
_
so anything that states SDGCC
I want the drop down box to have the special selection for adding all SDGCC
sites if that makes sense? I've tried it but I get duplicates if there is more than one row that contains the SDGCC
tag.
duplicates :
SDGCC_NEWTOWN_INBOUND
SDGCC_NEWTOWN_QH
SDGCC_BOLTON_QH
ARISE_HOME_ORDERS
ARISE_HOME_ENQUIRIES
etc...
So basically it'd have an option to select all SDGCC sites but because that database could change at any point we only need the first part of the string (ie the SDGCC, ARISE) sections to show up (once) in the select box.
I'm currently trying suggested query from below
SELECT DISTINCT SUBSTRING( tag, 0, LOCATE('_', tag ) ) FROM
dept_logintags
LIMIT 0 , 30
However this returns no rows