Re: convertion from string to time & substracting
| From: | Chris Knipe | Date: | Fri, 07 Jun 2002 18:49:29 +0000 |
| Subject: | Re: convertion from string to time & substracting | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101172@lists.php.net to get a copy of this message | ||
> 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 things you've told me and the mysql_error() as Chris said
You're LIKE clause is wrong / invalid
If $expression holds an HOUR field, it should be LIKE '$expression%';
if $expression holds a MINUTE field, it should be LIKE '%$expression';
having a LIKE '%$expression%' WILL NOT work... The % in a LIKE clause,
indicates that MySQL should have data BEFORE and AFTER $expression in the
column before it will be returned. Because it's a TIME column, and the way
in which you use $expression, it will either have only a % (additional data)
before, or after $expression, or NOT AT ALL.
So, the three options you have for this....
WHERE field LIKE '%$expression' / WHERE field LIKE '$expression%' /
WHERE field='$expression'
That's the only three options you have from what I see here... I've tested
all of this just now, and they all work wonderfully.