*HELP!!!* Simple PHP Echo error! Need quick help Please!

Discussion in 'PHP' started by Adwords., Feb 26, 2008.

Thread Status:
Not open for further replies.
  1. #1
    Alright, i have no idea why this isn't working.


    I have this in a php script (a function):


    echo rating_bar('177');

    The above works 100% FINE, but now instead of "177" i'm adding a php variable... (it's a digit also...)

    echo rating_bar('$picid');

    where $picid = "177";

    but it appears as "Picture id: $picid" when it should be "Picture id: 177"




    Please help asap! It's a matter of making echo rating_bar('$picid'); ECHO the variable instead of just showing the text.


    Thanks SO much to whoever helps, you will get +rep ofcourse
     
    Adwords., Feb 26, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    shallowink, Feb 26, 2008 IP
  3. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What shallowink said. Variables such as $picid do not get expanded to their value when placed inside single quotes, only double quotes. You don't really need any quotes at all though since you're only sending that one though, can just place the variable itself.
     
    zerxer, Feb 26, 2008 IP
Thread Status:
Not open for further replies.