> I got a mysql database, where two of the fields of a table
> record times as
> CHAR(8) in the format hh:mm:ss
> I want to take this two times and get the difference between
> them in seconds, for example 12:01:30 - 12:00:00 = 90 I
> looked up at the doc in the php.net website and could
> I got a mysql database, where two of the fields of a table
> record times as
> CHAR(8) in the format hh:mm:ss
This is one of those situations where having your database using the
most appropriate field types would help. When you've got it as CHAR
there's little you can do in the way of co
: Friday, June 07, 2002 3:27 PM
> To: [EMAIL PROTECTED]
> Cc: 'juaid'; [EMAIL PROTECTED]
> Subject: Re: [PHP] convertion from string to time & substracting
>
> I thought that it was a CHAR column. I didn't know you could use
> UNIX_TIMESTAMP() on CHAR co
[EMAIL PROTECTED]
>> Subject: Re: [PHP] convertion from string to time & substracting
>>
>>
>> On Friday, June 7, 2002, at 02:01 PM, juaid wrote:
>>
>>> sorry if maybe this is a bit dumb question, but I'm a begginer with
>>> php...
>>>
; To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] convertion from string to time & substracting
>
> - Original Message -
> From: "John Holmes" <[EMAIL PROTECTED]>
> To: "'juaid'" <[EMAIL PROTECTED]>; <[EMAIL PROTE
From: "Chris Knipe" <[EMAIL PROTECTED]>
> I also started off implementing mysql lookups
> without error checking and posted rather silly mistakes to the list which
> could have easily been avoided just debugging the code properly
%$&@#!!!
thank you very much Chris... stupid error.. I had done so
> where $month, $day and $year are got from a form in the previous page via
> POST method.
> So the LIKE condition matches against the "date" field in the table, where
> the format is like "Jun 7 2002"
>
> if I switch connTime, startTime and stopTime to TIME types, I get the
error
> I said
>
> I'l
- Original Message -
From: "John Holmes" <[EMAIL PROTECTED]>
To: "'juaid'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, June 07, 2002 8:29 PM
Subject: RE: [PHP] convertion from string to time & substracting
> That error
From: "John Holmes" <[EMAIL PROTECTED]>
>
> That error means your query failed and the result set is not valid. You
> can't use LIKE on a TIME column.
>
> Can you explain exactly what you want? How are you storing the times,
> what are the times, what kind of data do you want to pull out of the
>
> > Talking under correction, but you'll be better of using a TIME column in
> > MySQL. You can also do all the calculations with MySQL's build in time
> > functions already, which will save you allot of time, seeing that all
the
> > calculations can be done via a single SQL query.
>
> Yes, this
Thank you very much Erik, I'll try it :)
anyway, it would be nice to know what's wrong with the code I posted, why
does it work with CHAR and not with TIME types?
juaid
From: "Erik Price" <[EMAIL PROTECTED]>
>
> First of all, if you're storing time then you're better off using the
> DATETIME c
easy query to get exactly what you need
if you use the correct column types.
---John Holmes
> -Original Message-
> From: juaid [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 07, 2002 2:20 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] convertion from string to time
ECTED]
> Subject: Re: [PHP] convertion from string to time & substracting
>
>
> On Friday, June 7, 2002, at 02:01 PM, juaid wrote:
>
> > sorry if maybe this is a bit dumb question, but I'm a begginer with
> > php...
> >
> > I got a mysql database, w
note that I put:
$startTime = $linea["startTime"];
I misppeled it while copying, this shuold be
$startTime = $line["startTime"];
juaid
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Friday, June 7, 2002, at 02:22 PM, Erik Price wrote:
> First of all, if you're storing time then you're better off using the
> DATETIME column type. Even though it may take a bit more space than
> CHAR(8), unless you absolutely need the ultimate in table optimization,
> use DATETIME.
I
On Friday, June 7, 2002, at 02:01 PM, juaid wrote:
> sorry if maybe this is a bit dumb question, but I'm a begginer with
> php...
>
> I got a mysql database, where two of the fields of a table record times
> as
> CHAR(8) in the format hh:mm:ss
>
> I want to take this two times and get the dif
From: "Chris Knipe" <[EMAIL PROTECTED]>
>
> Talking under correction, but you'll be better of using a TIME column in
> MySQL. You can also do all the calculations with MySQL's build in time
> functions already, which will save you allot of time, seeing that all the
> calculations can be done via
> Sent: Friday, June 07, 2002 2:02 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] convertion from string to time & substracting
>
> Hi,
>
> sorry if maybe this is a bit dumb question, but I'm a begginer with
php...
>
> I got a mysql database, where two of the fiel
- Original Message -
From: "juaid" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 07, 2002 8:01 PM
Subject: [PHP] convertion from string to time & substracting
> Hi,
>
> sorry if maybe this is a bit dumb question, but I'm a begginer with p
Hi,
sorry if maybe this is a bit dumb question, but I'm a begginer with php...
I got a mysql database, where two of the fields of a table record times as
CHAR(8) in the format hh:mm:ss
I want to take this two times and get the difference between them in
seconds, for example 12:01:30 - 12:00:00
20 matches
Mail list logo