Search for Complete TAG in tags field

90 0 0 2

Last Updated : 2020-10-24 12:31:56

There is how to search for a complete tag word in a comma separated values field in DB table.

$query->where('tags', 'RLIKE', "^[[:<:]]{$tag}[[:>:]],")->orwhere('tags', 'RLIKE', "^[[:<:]]{$tag}[[:>:]]$")->orwhere('tags', 'RLIKE', ",[[:<:]]{$tag}[[:>:]],")->orwhere('tags', 'RLIKE', ",[[:<:]]{$tag}[[:>:]]$");

Mohammed Anwar

Mohammed Anwar

Experienced technical lead PHP, MySQL and Laravel Developer for 15+ years, with proven ability to develop and create high-quality and optimized web applications. Great ability to build and optimize database design, schema and queries. Versed programing trainer and instructor delivering web courses and helping others to get into the field in a timely manner. Fast and eager learner for new technologies .

2 Comments

  • Image placeholder

    Mohammed Anwar

    2020-08-08 19:16:42

    Wow, That's truly nice snippet of code :)

  • Image placeholder

    Mohammed Anwar

    2020-08-08 21:45:05

    Thank from here again :)