PHP help with using variable inside code

By : Cameron
Source: Stackoverflow.com
Question!

I have this line of code: <?php global $bp; query_posts( 'author=$bp->displayed_user->id' ); if (have_posts()) : ?> but it doesn't work as expected. Probably because it's not grabbing the $bp->displayed_user->id part correctly. How do I do it?

Thanks

By : Cameron


Answers

Using single quotes makes PHP do not fetch the variable value. Instead of using single quotes you can use double quotes:



It isn't working because it's treating the 'author=$bp-



By : Tomik


This video can help you solving your question :)
By: admin