Re: Selecting all records between a date range
| From: | Jason Pruim | Date: | Thu, 02 Oct 2008 17:40:54 +0000 |
| Subject: | Re: Selecting all records between a date range | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281403@lists.php.net to get a copy of this message | ||
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