Re: [PHP] Question about date()




On Oct 7, 2008, at 7:41 AM, Stut wrote:

On 7 Oct 2008, at 12:38, Jason Pruim wrote:
I am trying to track down an error and can't seem to figure it out... Here is the error out of my log:

[Tue Oct 7 07:31:43 2008] [error] PHP Warning: date() expects parameter 2 to be long, string given in /Volumes/RAIDer/webserver/ Documents/dev/stimecard/timecard.php on line 57


Here is line 57:

$timeout = date("m/d/y h:i:s A", $row['timeout']);


And the info that is trying to grab from the database is:

+------------+------------+-------+--------+-------------------+
| timein | timeout | empID | record | Name |
+------------+------------+-------+--------+-------------------+
| 1222354037 | 1222382837 | 1 | 107 | Jason Pruim |
+------------+------------+-------+--------+-------------------+

Now... the error only happens on line 57... On line 56 there is the same command except: $timein = date("m/d/y h:i:s A", $row['timein']);

And that doesn't cause any errors so I'm at a bit of a loss as to what to do? I know I can redirect the warning to an error message, but I don't want to do that... I am trying real hard to write clean code... And this is my last error...

It's a total cosmetic thing since it still displays everything right...

Any ideas? :)

Do a var_dump($row['timeout']) on the line before the one giving the warning to check that it contains what you think it does.


Hey Stut,

Thanks for the quick response... You were right... I did a var_dump both on $row['timein'] and $row['timeout'] and the error was because of the way that I update the records. for time in, I insert a new record, for time out, I update the record where timeout= NULL and THAT is what was causing the issue... I guess I can just redirect that error, ignore it, or come up with a different way to update the current record without having to use NULL, or maybe, write a timeout timestamp for like midnight on January 1 1955 or something like that...

Thanks again Stut!


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@xxxxxxxxxx




.



Relevant Pages

  • Re: [PHP] Question about date()
    ... string given in /Volumes/RAIDer/webserver/ Documents/dev/stimecard/timecard.php on line 57 ... I know I can redirect the warning to an error message, but I don't want to do that... ... I guess I can just redirect that error, ignore it, or come up with a different way to update the current record without having to use NULL, or maybe, write a timeout timestamp for like midnight on January 1 1955 or something like that... ...
    (php.general)
  • Re: trap warnings under program control
    ... yes it is better to redirect to string. ... Code with evalc should be faster ... pseudo code to be done when there is no warning. ...
    (comp.soft-sys.matlab)
  • Re: You are about to be redirected to a connection that is not secure
    ... hits a third party web site which causes this problem so the application ... > redirected to a non-secure page to handle the request. ... The warning dialog ... > redirect on client side. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: permanent redirect and ssl
    ... Since the redirect over HTTPS is happening correctly (next to the Cert ... warning -- which is expected), what you are observing is a browser-specific ... blank hostheader and have the site redirected to http://www.mycompany.com. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Referring pages?
    ... >username and password but not the warning screen. ... >user does bookmark a site and they did not go through the warning page first ... >it would redirect them there? ... not a function of IIS. ...
    (microsoft.public.inetserver.iis)