Hi,
I'm a little confuse about variable scope in PHP.
I have a file "setting.php" contains a line: $tablename = 'mytable';
I have a file "utility.php" has a function:
function insertintotable($info){
$query = "INSERT INTO ".$tablename." (info) values ($info)";
}
My problem is that inside a function I could not access $tablename variable from setting.php even though I use a "include 'setting.php' in the utility.php.
After include 'setting.php', I could access $tablename variable no problem, but inside a function I can not.
How do I access $tablename inside the function?
TIA