php - Store a variable as variable in database -
hello im building multilenguaje app in php, first time handle multilenguaje, im trying this.
for months example
i have table "months" id | month estructure
in users table have id | username | month_id
my guess (bad guess) can save example $january direct on database in php when called, looked defined variable.
$january = "january"; , if im on spanish web change $january = "enero";
but not working (obviusly because prints result of call $january, saved $january in database)
how best method im trying do.. cause im lost in point.. , need estructure in database lot of reasons wont mention, right now,
thanks!
my code
this $row2['months']
print $january
even when in php code have set $january = "enero";
to php evaluate variable, need eval:
$january='enero'; $row='$january'; echo $row; //prints $january echo php_eol; echo eval("return ".$row.";"); //prints enero here in ideone: http://ideone.com/f0lct0
Comments
Post a Comment