Re: Selecting all records between a date range

From: Date: Thu, 02 Oct 2008 17:58:33 +0000
Subject: Re: Selecting all records between a date range
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-281410@lists.php.net to get a copy of this message
On Oct 2, 2008, at 1:45 PM, Robbert van Andel wrote:
In the original message you were assigning the query to $SQLTEST, but in the code below you're using $sql.
It was a clean up... I had a working query... $sql so in attempting to improve this I didn't want to lose the original sql so I developed in $SQLTEST which worked perfectly. Also, $sql is defined in a fairly extensive switch statement so I didn't want to get rid of all of that for testing :0
On Thu, Oct 2, 2008 at 10:40 AM, Jason Pruim <japruim@raoset.com> wrote: On Oct 2, 2008, at 1:31 PM, Robbert van Andel wrote:
What is the actual code that you use to run the query. You've shown us how you set up the query but not more. Something like $result = mysql_query($query,$conn);
Here is the code I use: $row[]= mysql_query($sql) or die("Could not perform query: " . mysql_error()); $result = $row[0]; while ($row = mysql_fetch_assoc($result)){ $timein = date("m/d/y h:i:s", $row['timein']); $timeout = date("m/d/y h:i:s", $row['timeout']); $totalday = ($row['timeout'] - $row['timein']); $totalday = $totalday/60/60; $totalday = round($totalday, 2); $totalWeek += $totalday; // Builds the total from the daily total echo <<<ADMIN <tr> <td>{$row['Name']}</td> <td>{$timein}</td> <td>{$timeout}</td> <td>{$totalday}</td> </tr> ADMIN; } # Display Weekly total echo <<<WEEKTOTAL <tr> <td colspan='4' align='right'>TOTAL FOR WEEK: {$totalWeek}</td> </tr> WEEKTOTAL; echo "</table> </div> </body>"; Works out really well. Now I just need to show it to the boss, change every possible thing about it, until I hate it and they love it and call it good :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com japruim@raoset.com
-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com japruim@raoset.com

« previous php.general (#281410) next »