the resulting output with that code is a little weird. I get September
3, 1970 2:39:32pm

I think part of the problem is my Query. When I run it in PHP MyAdmin
I get a null value for login_timestamp even though there is indeed a
timestamp there. The Query again is:

SELECT 
Responses.editor_name,Answer1,Answer2,Answer3,Answer4,Answer5,Answer6,Answer7,Answer8,Answer9,Answer10,Answer11,Answer12,submit_timestamp,login_timestamp
        FROM Responses LEFT JOIN Candidates USING (user_id)

login_timestamp is in a table called 'Candidates' and submit_timestamp
is in a tables called 'Responses'.

thanks for all the help to this point.

On Tue, May 25, 2010 at 2:28 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:
> On Tue, 2010-05-25 at 14:22 -0400, Bruce Gilbert wrote:
>> echo "<tr><th>Completion Time:</th></tr><tr><td>". date('F j, Y
>> g:i:sa',strtotime($row['submit_timestamp']) -
>> strtotime($row['login_timestamp']))/60 , "</td></tr>";
>
> There's a good reason for that! What you're actually doing is this:
>
> echo "<tr><th>Completion Time:</th></tr><tr><td>" .
>  date('F j, Y g:i:sa',
>    strtotime($row['submit_timestamp']) -
>    strtotime($row['login_timestamp'])
>  )
>  / 60
>  , "</td></tr>";
>
> You're trying to divide a string by 60, because date() returns a string.
> Put that division inside the brackets for date() rather than outside.
>
> It might help to break up that whole line of output into several parts.
> Put the date into a variable and then just output the HTML line:
>
> $date = date('F j, Y g:i:sa', (strtotime($row['submit_timestamp']) -
> strtotime($row['login_timestamp']))/60);
> echo "<tr><th>Completion Time:</th></tr><tr><td>$date</td></tr>";
>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>



-- 
::Bruce::

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to