FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » missing variable
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: missing variable [message #175845 is a reply to message #175844] Sun, 30 October 2011 19:57 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Sun, 30 Oct 2011 08:59:44 -0400, bill wrote:

> if ($ptNum == "empty") return // do nothing, do not need to
> create an empty appointment, as there is already an identical one
> $hist = "empty appointment filled ". nowUS() ." by "
> .$_SESSION['current_user'] . "\n";

No ";" after the preceding "return"

so without the $hist=""; line what you have is:

if ($ptNum == "empty") return $hist = "empty appointment filled ". nowUS
() ." by " .$_SESSION['current_user'] . "\n";

In other words, the first $hist value after the return is only defined if
it's being returned from the function, because it comes between the if
($ptNum == "empty") and the next ";"

The // only creates comments to the end of line, it doesn't terminate the
return

So your if statement assigns the $hist value and immediately uses it as
the return value, when what you want is to assign the value if you didn't
return.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: json and special chars
Next Topic: integer and string what's the difference ?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 06:52:58 GMT 2024

Total time taken to generate the page: 0.04687 seconds