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

From: Date: Fri, 07 Jun 2002 18:29:14 +0000
Subject: RE: [PHP] convertion from string to time & substracting
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101166@lists.php.net to get a copy of this message
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? I'll guarantee that there is one easy query to get exactly what you need if you use the correct column types. ---John Holmes.... > -----Original Message----- > From: juaid [mailto:juaid@juanin.com] > Sent: Friday, June 07, 2002 2:20 PM > To: php-general@lists.php.net > Subject: Re: [PHP] convertion from string to time & substracting > > From: "Chris Knipe" <savage@savage.za.org> > > > > 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 first thing I thought, but doing this I get an error when > getting the records.. I'm using the following code: > > <SNAP> > $result = mysql_query("SELECT * FROM tableNameWHERE field LIKE > '%$expression%'"); > > while ($line = mysql_fetch_array($result)) { > $startTime = $linea["startTime"]; > $stopTime = $line["stopTime"]; > } > <SNAP> > > If the fields are CHAR or VARCHAR I got no problem, but if a use a TIME > type > I get the following error: > "Warning: Supplied argument is not a valid MySQL result resource in > /var/www/text.php on line XX" > > what am I missing? the mysql_fetch_array should only be used with CHAR > types > and so? what should I use then? > > thanks again for the help > > juaid > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#101166) next »