Re: [PHP] LIKE condition in query

2002-11-05 Thread Don Hicks
BINGO!

That was exactly what I needed!

Thanks!
Don.
===

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:003801c284fc$4fd8d2b0$8102a8c0@;000347D72515...
> [snip]
> $Query="
> SELECT FieldName1, FieldName2
> FROM TableName
> WHERE FieldName1 LIKE '$CriterionRecord'
> ";
> [/SNIP]
>
> The LIKE criteria needs to be surrounded by wildcards...
>
> WHERE FieldName1 LIKE '%$CriterionRecord%'
>
> HTH!
>
> Jay
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] LIKE condition in query

2002-11-05 Thread Jay Blanchard
[snip]
$Query="
SELECT FieldName1, FieldName2
FROM TableName
WHERE FieldName1 LIKE '$CriterionRecord'
";
[/SNIP]

The LIKE criteria needs to be surrounded by wildcards...

WHERE FieldName1 LIKE '%$CriterionRecord%'

HTH!

Jay


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] LIKE condition in query

2002-11-05 Thread .: B i g D o g :.

I am not up on my MS Access database sql but i would check to see if ms
access supports the like condition in the where clause...


On Tue, 2002-11-05 at 18:49, Don Hicks wrote:
> I'm writing an SQL query in a php 4.0 script.  The query pulls data from an
> MS Access '97 database through an ODBC connection.
> 
> I'm having difficulties creating a condition using "LIKE".
> 
> If I write the following expression, the query works:
> 
> $Query="
> SELECT FieldName1, FieldName2
> FROM TableName
> WHERE FieldName1 = '$CriterionRecord'
> ";
> 
> But, if I change the Where statement from "=" to "LIKE", the query no longer
> works, and I can't figure out why. (Could it be punctuation?) Here's an
> example:
> 
> $Query="
> SELECT FieldName1, FieldName2
> FROM TableName
> WHERE FieldName1 LIKE '$CriterionRecord'
> ";
> 
> The criterion record is actually chosen in another form and passed through
> to this script.  The criterion record may be a complete record, or it may be
> a partial record with a wildcard, but the "LIKE" script is not working in
> either case.
> 
> Does anyone have any experience with this they could share with me?
> 
> Sincerely,
> Don Hicks
> Portland, OR
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
.: B i g D o g :.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php