Lets say you have a table with field called "tags" that consists from tags separated by commas and you want to check whether it includes a required tag. Here the simplest ways of doing that.
Lets say you have a table with field called "tags" that consists from tags separated by commas and you want to check whether it includes a required tag. Here the simplest ways of doing that.
Tags: search tags , set tags
Code Snippet:
-- 1st way
SELECT *
FROM TABLE
WHERE FIND_IN_SET(" '.$tag.'", CONCAT(" ", TABLE.tags))
LIMIT 1;
-- 2st way
SELECT *
FROM TABLE
WHERE '.$tag.' IN(TABLE.tags)
LIMIT 1;
ActionScript - ActionScript 3 - Apache - AppleScript - ASP - Assembler - Bash - C - C# - C++ - ColdFusion - CSS - Delphi - DOS Batch - Fortran - HTML - iPhone - Java - JavaScript - jQuery - Lisp - MatLab - Maxscript - MXML - MySQL - Objective C - Other - Pascal - Perl - PHP - PL SQL - Prolog - Pseudocode - Python - Rails - SmallTalk - Smarty - SML - SPSS - SQL - SVN - Symfony - TCL - VB.NET - Visual Basic - XHTML - XML - XSLT
© 2000-2015 Xentrik.Net