Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3640

Re: missing variable

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.cablespeedmi.com!news.cablespeedmi.com.POSTED!not-for-mail
NNTP-Posting-Date Mon, 31 Oct 2011 05:30:46 -0500
Date Mon, 31 Oct 2011 06:30:46 -0400
From bill <nobody@spamcop.net>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version 1.0
Newsgroups comp.lang.php
Subject Re: missing variable
References <-4adnYXjVd2CyjHTnZ2dnUVZ_oudnZ2d@cablespeedmi.com> <j8hrj3$tls$1@news.albasani.net> <BdCdneCS9Orf1zDTnZ2dnUVZ_vGdnZ2d@cablespeedmi.com> <4eadac1b$0$28493$a8266bb1@newsreader.readnews.com>
In-Reply-To <4eadac1b$0$28493$a8266bb1@newsreader.readnews.com>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <rfGdnZz2AtZL5TPTnZ2dnUVZ_sKdnZ2d@cablespeedmi.com> (permalink)
Lines 32
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 24.56.193.205
X-Trace sv3-hERFJSkpeDFJWKKEKUH/QA6UazRAP5wmnjx/GjjJRIDHqf3hEPm3+Fwm7yHr+cfQZxFy5Xi48yowJBV!kWXDrxDzXCttYmVIUzfYJgyaN9RXv4vAeD3QkbYGsfBcbUMpn9aaLSSNDXzwMmhfVrxX6FqAUr8d!D1E903c6ajGhmZUHFXtJqwpajA==
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2373
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:3640

Show key headers only | View raw


On 10/30/2011 3:57 PM, Denis McMahon wrote:
> 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

Good catch.  Thank you so much !
bill

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

missing variable bill <nobody@spamcop.net> - 2011-10-29 15:42 -0400
  Re: missing variable Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-10-29 23:35 +0200
    Re: missing variable bill <nobody@spamcop.net> - 2011-10-30 08:59 -0400
      Re: missing variable Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-30 19:57 +0000
        Re: missing variable Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-30 19:29 -0400
          Re: missing variable Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-31 00:37 +0000
        Re: missing variable bill <nobody@spamcop.net> - 2011-10-31 06:30 -0400

csiph-web