i have variable $lang which convert string to the selected language but i am unable to convert the string getting form database
working
echo $lang["hello"];
not working
$rowtxt = $row[0];
echo $lang[$rowtxt];
it shows error.
what is the correct way to do this can any one tell me i am a beginner ?.
You should better a try var_dump($row) or print_r($row) first to see if the array contains the datas at right keys.
$lang[$row[0]] doesnt work because $row[0] is empty.
Your are probably not assigning Hello to $row[0].
So try print_r($row); to see whats stored in the whole array.
Add :
$lang[$row[0]] will give you $lang[hello].
It should be $lang[“$row[0]”] for it to be $lang[“hello”]
Sample code :
Please change your attitude. Give out codes, and wait for people to answer. People are here to help.
Ask your question and people will answer you, but please dont DEMAND.