Re: Selecting all records between a date range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the original message you were assigning the query to $SQLTEST, but in the
code below you're using $sql.

On Thu, Oct 2, 2008 at 10:40 AM, Jason Pruim <japruim@xxxxxxxxxx> 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@xxxxxxxxxx
>
>
>
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux