|
Posted by Erwin Moller on 01/12/07 09:49
Maximus wrote:
> That's not the case,
>
> The case is: I have a database table with rows ID and NAME
>
> ID=1 NAME=$home
> ID=2 NAME=$about
>
> I make a mysql_fetch_object that grabs the data and echos it in a
> table. I want it to echo $home where $home is a variable with some
> value.
>
> I need the user to view the $home value .. not the word "$home" itself.
Hi,
I am not sure I can follow you.
Did you actually try my code example?
It doesn't show '$myvarname', but 'I am some var', which is the content of
the variable $myvarname, which is defined by $bla.
So what is the difference with your problem?
In your case you'll end up with a row, like this:
for(..fetchrowstuff in $row..){
echo $row["NAME"]." contains:".$$row["NAME"];
// or cleaner IMHO:
echo $row["NAME"]." contains:".${$row["NAME"]};
}
Or am I brainfarting and missing your problem?
Regards,
Erwin Moller
>
> Erwin Moller wrote:
>> Maximus wrote:
>>
>> > Guys,
>> >
>> > I have a mysql query that grabs data from the table ... the data is
>> > "variable names" something like $home $about $contact
>> >
>> > I need the loop to echo those variables as PHP Code, so that they are
>> > replaced with the variable value and not the variable name.
>> >
>> > any quick function for that?
>>
>> Hi,
>>
>> $bla = "myvarname";
>> $myvarname = "I am some var";
>> echo $$bla;
>>
>> Regards,
>> Erwin Moller
Navigation:
[Reply to this message]
|