I have a PHP variable thats value is set at the start of my document but when I use my WHILE LOOP it get UNDEFINED and stops working.
Can anyone help how to keep this value assigned?
The variable I’m trying to keep defined is $lang
$lang = "en";// base url
function getAccountDeliveryDetails($id){
$query = "SELECT * FROM tbl_user_delivery WHERE user_id = '$id'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$phrase = array(
'de' => 'Bearbeiten',
'en' => 'Edit',
'es' => 'Editar',
'fr' => 'Éditer',
'it' => 'Modifica');
echo $phrase[$lang];
}
}
inside a function you need to use global. first line in function