Researched a bit and tried again, still can't get this to work:
Code: Select all
function gstop($m){
global $addError, $message;
$addError = 1;
$message .= "<br />Error: $m <br />";
}
$addError = 0;
rename ("./file/arcade/upload/$fEntry/$pic1", "./file/arcade/images/$pic1") or gstop("Could not move picture 1.");
if($addError == 0)
{
$message .= "<br />$pic1 successfully imported...";
}
According to the manual, it should work, since I'm globaling the variables within the function... but it doesn't. Any ideas?
Chris Corbyn wrote:Yes, if you don't specify global then it just creates a variable in "local scope" and then discards it after the function has ended.
I'm not sure this is a great way to learn about functions however, really you want to take some parameters in, and return a value back out.
If I use "return" don't I have to use an equality to get the returned value? Like...
But as it seems, I cant use that in my "or" statement for testing if the rename went through or not.