Search code examples
phpmysqldatabasetagsphalcon

Retrieve Tags from db phalcon


I'm implementing a blog with phalcon. there have a tag field followed by: https://github.com/mfiels/tagsly/blob/master/index.html

its insert multiple value into the db. but dont understand how to retrieve array value from tags field.

i want to render all tags list and if a user click on that tag, then it should render list of all related post. i mean in function im unable figure it $tags = Blogs::find(); how to find array value with like clause? Or am i going wrong? or is there any easy way? please...

My db looks like this


Solution

  • Did you try something like:

    $result = Blogs::find([
        'tag LIKE :tag:',
        'bind' => ['tag' => $tag],
    ]);