In the db I have rows listed like so: id | title | text | userid | upload_date | tag1 | tag2 | tag3 | tag4 | tag5 I thought about writing an extra long query with: WHERE tag1 LIKE '%$tag1%' OR tag1 LIKE '%tag2%' all the way up until OR tag5 LIKE '%$tag5%' Is there any easier way to do it?
Two options: make it so that there would be only one tag field (values separated by comma or anything else of that kind); generate SQL query dynamically (Google has quite a few good examples on this).