Forum Moderators: coopster

Message Too Old, No Replies

Using eval() to get variable from database

eval variable database php

         

smorgasbord

5:40 am on Sep 10, 2009 (gmt 0)

10+ Year Member



I am wondering if it is possible to store a variable in a database, but only use the commando eval() in the column with the variable, not in the column with the value.

For using it with both columns I can do as follow:

<?php
eval("$" . $info["name"] . "=\"" . $info["value"] . "\";");
?>

But I do not won't to use eval() on the value-column...

jatar_k

4:45 pm on Sep 15, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld smorgasbord,

no need for eval, you just want a variable variable

$thevarname = $info["name"];
$$thevarname = $info["value"];

echo $thevarname; // should give the value of $info["name"]
echo $$thevarname; // should give the value of $info["value"]