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.

member_id tag in a query tag ?

August 27, 2007 3:24pm

Subscribe [1]
  • #1 / Aug 27, 2007 3:24pm

    Aircom

    29 posts

    Hi,

    I’m trying to run this query, but it gives no result:

    {exp:query sql="SELECT item_id FROM exp_simple_commerce_purchases WHERE member_id = '{member_id}’ “}

    If I replaces {member_id} by a hardcoded number it works.

    Thank you

    Nicolas

  • #2 / Aug 28, 2007 1:00pm

    Robin Sowell

    13255 posts

    You’re running into a parse order issue.  The easy way around this is to use some php parsed on input and the sessions class:

    <?php
    global $SESS;
    $id = $SESS->userdata['member_id'];
    ?>
    {exp:query sql="SELECT item_id FROM exp_simple_commerce_purchases WHERE member_id = '<?php echo $id; ?>' LIMIT 1"}

    See if that does the trick- and remember, php needs to be parsed on input.

  • #3 / Aug 28, 2007 1:05pm

    Aircom

    29 posts

    Thank you Robin, it works.
    Also I sent you an email to ask you the status of download lock pro but got no answer. Can you tell me please? This is highly wanted here.
    Thx

    Nicolas

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

ExpressionEngine News!

#eecms, #events, #releases