ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using variables in a query

June 12, 2013 2:08pm

Subscribe [1]
  • #1 / Jun 12, 2013 2:08pm

    totalpeople

    6 posts

    Hi all

    Just trying to work out how to properly write the following…

    {exp:query sql="SELECT cat_name FROM exp_categories WHERE cat_id = {segment_2} "}
            {cat_name}
    {/exp:query}

    {segment_2} brings back C6 (for example) but I just need the ‘6’. I’ve tried phpstringfun but it ends up parsing everything like below…

    {exp:phpstringfun function="substr" par="0"}C5{/exp:phpstringfun}

    Can anyone point me in the right direction please?

    Thanks

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases