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 could

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 co

RE: [PHP] convertion from string to time & substracting

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

Re: [PHP] convertion from string to time & substracting

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

RE: [PHP] convertion from string to time & substracting

2002-06-07 Thread John Holmes
; 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

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

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'l

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

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 >

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

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 c

RE: [PHP] convertion from string to time & substracting

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

RE: [PHP] convertion from string to time & substracting

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

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

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 dif

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

RE: [PHP] convertion from string to time & substracting

2002-06-07 Thread John Holmes
Is there a reason you insist on using a CHAR field, instead of a TIME field, which would make this all easier and allow you to use the multitude of MySQL Date and Time Functions in your query... ??? ---John Holmes... > -Original Message- > From: juaid [mailto:[EMAIL PROTECTED]] > Sent: F

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. -- me - Original Messag