REGEXP kullanın.
6 ve 15 değerleri için
$sql = "SELECT * FROM test1 WHERE ids REGEXP '[[:<:]]6[[:>:]].+[[:<:]]15[[:>:]]'";