explode( ' ', $serachTags )
実行した後、または各タグを取得するために、このようなことを行うことができます。
SELECT
images.img_name,
images.img_url
FROM
images,
connections,
tags AS tagA,
tags AS tagB,
tags AS tagC,
...
WHERE
images.img_id = connections.img_id AND
tagA.tag_id = connections.tag_id AND
tagA.tag_name = 'name1' AND
tagB.tag_id = connections.tag_id AND
tagB.tag_name = 'name2' AND
tagC.tag_id = connections.tag_id AND
tagC.tag_name = 'name3' AND
...
I.e。花とピンクの場合は、次のことができます。
SELECT
images.img_name,
images.img_url
FROM
images,
connections,
tags AS tagA,
tags AS tagB
WHERE
images.img_id = connections.img_id AND
tagA.tag_id = connections.tag_id AND
tagA.tag_name = 'flower' AND
tagB.tag_id = connections.tag_id AND
tagB.tag_name = 'pink'