I'm making a script for changing e-shop prices. This is my settings panel (key variables)
// --- <SETTINGS PANEL> --- //
$safe_mode = true;
$safer_mode = false;
$safe_cycle = false;
$file_loc = 'cata.txt';
$skuindex = '1';
$nameindex = '2';
$priceindex = '0';
$rowdelimiter = '_';
$celldelimiter = '-';
// --- </SETTINGS PANEL> --- //
Later on I'm using my safe_mode variable here:
function updateit($pricus,$skus,$namef)
{
if($safer_mode)
{
$querytoup = "UPDATE product SET margin = '', vat_id = '1', cost = '', price = '".$pricus."' WHERE sku LIKE '".$skus."' AND name LIKE '".$namef."';";
}
else
{
$querytoup = "UPDATE product SET margin = '', vat_id = '1', cost = '', price = '".$pricus."' WHERE sku LIKE '".$skus."' AND name LIKE '".$namef."%';";
};
echo('Establishing connection...<br>');
updateexec($querytoup);
};
updateexec(); then executes a bit more complex function I don't want to paste here. The problem is that I'm getting this kind of error/notice:
Notice: Undefined variable: safer_mode in /var/www/doit.php on line 54
Line 54 is exactly the if($safer_mode) line. So where did I go wrong? I know this stuff happens when you declare a variable inside a loop/function that doesn't run under some conditions so it's undeclared, but I'm declaring $safe_mode outside any functions, the settings panel is in the beginning of the file. I'm not running any includes or requires. Thanks for any replies.
;after closing}, which is not used in PHP)updateit()function.