[PHP] convertion from string to time substracting

2002-06-07 Thread juaid
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

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Chris Knipe
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 php... I got a mysql database, where two of the fields

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread John Holmes
: 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 fields of a table record times as CHAR(8) in the format

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread juaid
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 a single

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Erik Price
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 difference

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Erik Price
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

Fw: [PHP] convertion from string to time substracting

2002-06-07 Thread juaid
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

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread John Holmes
] 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, where two of the fields of a table record times as CHAR(8) in the format hh:mm:ss

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread John Holmes
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 substracting From: Chris

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread juaid
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 column

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Chris Knipe
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 is the

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread juaid
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 table?

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Chris Knipe
- 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 means your query failed and the result set is not valid. You can't

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Chris Knipe
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'll try the

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread juaid
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 many

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread John Holmes
PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] convertion from string to time substracting - 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

Re: [PHP] convertion from string to time substracting

2002-06-07 Thread Erik Price
UNIX_TIMESTAMP() in your query, then you won't need any of that PHP code you just wrote... ---John Holmes... -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Friday, June 07, 2002 2:22 PM To: juaid Cc: [EMAIL PROTECTED] Subject: Re: [PHP] convertion from string to time

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread John Holmes
, 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 columns, so I was showing him how to turn his colon delimited strings

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread David Freeman
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

RE: [PHP] convertion from string to time substracting

2002-06-07 Thread Lazor, Ed
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 couldn't