Re: convertion from string to time & substracting
| From: | juaid | Date: | Fri, 07 Jun 2002 18:19:40 +0000 |
| Subject: | Re: convertion from string to time & substracting | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101160@lists.php.net to get a copy of this message | ||
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