The database stores the tags separated by a space, how to display them, what would they be separately? And then, for example, if there are 2 tags in a column, look for the one that is needed, and not the full line?
2 answers
Design level error. Obviously, tags are an entity for which a separate table is needed.
|
Do you have all the tags in one line (records)? Then using standard PHP tools, select a line from the database and parse:
explode(" ", $db_query);
Get at the output an array with tags.
Just do not confuse the order of parameters for the function explode (). About this feature is written in detail here .
and then for example, if there are 2 tags in a column, look for the one that is needed, and not the full line?
I do not understand, rephrase.
- yes that's right, if 2, look for the one that is needed? - foozzi
- Search already in php. Otherwise - break the string of tags in the sql query (disassembled at stackoverflow.com) - alexlz
|