Your tags should be in a separate table, with a cross-table between the two. I haven't tested this (and don't have the means to ATM), so would likely need 'tweaking' (possibly needs JOIN LEFT):
TABLE 1
code:
ImageID Image
1 cat.jpg
2 mouse.jpg
3 hamster.jpg
4 dog.jpg
TABLE 2
code:
TagID Tag
1 nice
2 bitey
3 fuzzy
TABLE 3
code:
ImageID TagID
1 1
4 1
2 2
3 2
1 3
2 3
3 3
4 3
SQL (pronounced 'sequel')
sql code:
SELECT t1.* FROM images t1
JOIN crosstab t2 ON t1.ImageID=t2.ImageID
JOIN tags t3 ON t2.TagID=t3.TagID
WHERE t3.Tag='fuzzy' AND t3.Tag='bitey';
EDITED: 24 Mar 2011 10:28 by MR_BASTARD