Re: Problem with mysql_fetch_array tests.

From: Date: Sun, 13 Apr 2008 10:14:59 +0000
Subject: Re: Problem with mysql_fetch_array tests.
References: 1 2  Groups: php.qa 
Request: Send a blank email to php-qa+get-64176@lists.php.net to get a copy of this message
On 11.04.2008, at 16:18, Josie Messa wrote:
On Fri, Apr 11, 2008 at 1:09 PM, ed slattery <slattery@uk.ibm.com> wrote:
This group of tests pass parameters to a main function, which pushes the values into a database and validates the result. Sometimes the parameters passed are something like: func_mysql_fetch_array($link, $engine, "TIME", @date('H:i:s'), @date('H:i:s'), 480); where the two calls to date give the date to push, and the date to check the response against. Since these are separate calls, sometimes you are unlucky enough to pass over a second between the calls, and get a different date for the comparison from the original. The test would be more reliable written as: $x = @date('H:i:s'); func_mysql_fetch_array($link, $engine, "TIME", $x, $x, 480);
Unless anyone has any objections I'll commit this change?
Maybe using $_SERVER['REQUEST_TIME'] is the best solution anyways to get the "current" for the request (unless you are interested in a specific point in time during the request). And then you can just pass that in as a parameter to the date() calls. regards, Lukas

« previous php.qa (#64176) next »