1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need a function to fill a variable

Discussion in 'PHP' started by Rahul Bose, Jun 28, 2010.

  1. #1
    HI,
    I need a function to make and fill a variable because the variables name comes from the db .How can I do so?
    Thanks
    SEMrush
     
    Rahul Bose, Jun 28, 2010 IP
    SEMrush
  2. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #2
    when you have an array and you extract them, then you should have those vars already
     
    gapz101, Jun 28, 2010 IP
  3. Michellu

    Michellu Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You probably what something like this:
    
    //you get the variable name from mysql in $var_name_from_db
    //let's say $var_name_from_db='my_variable_name';
    $$var_name_from_db='1234';
    
    echo $my_variable_name; //this prints: 1234
    
    PHP:
     
    Michellu, Jun 28, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0