We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Simple SQL Query for Current User

Development and Programming

pcm's avatar
pcm
17 posts
14 years ago
pcm's avatar pcm

EDIT: Found the solution here–just wasn’t searching right to pull up this entry:

http://ellislab.com/forums/viewthread/184043/

Hey,

This seems simple, and yet it’s not working. All I’m doing is pulling some comments from the db and I want to make sure this area only shows comments the current user has made. Simple, right?

{exp:query sql="SELECT name, author_id, comment_date, comment FROM exp_comments WHERE author_id = '{logged_in_member_id}'"}

    <h4>{name}</h4>
     {comment}

{/exp:query}

I do pull data without the WHERE statement, so it’s related to the WHERE statement. I’m thinking it’s a parsing order problem, but the typical solution throws a PHP error for me:

<?php
global $SESS;
$member = $SESS->userdata['member_id']; 
?>

I have PHP turned on, and set to input, so that’s not the issue.

Anyone know why this isn’t working?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.