This is a discussion on ODBC Query of Access 2000 db using LIKE within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Attempting to query MS Access database with the ODBC drivers for PHP. When using the LIKE statement no records are ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Attempting to query MS Access database with the ODBC drivers for PHP. When
using the LIKE statement no records are returned. Example: $query = " Select * From Dispatch Where Customer Like '*A*' "; $result = odbc_prepare($db,$query); odbc_execute($result); Does anyone out there know the syntax that I should be using for the Like statement in the Where clause? When I do a normal query, it works fine....Just using wildcards it does not work.... |
|
|||
|
Jahmil Richardson <jahmil@thehelpesk.com> wrote:
> $query = " Select * From Dispatch Where Customer Like '*A*' "; > > Does anyone out there know the syntax that I should be using for the Like > statement in the Where clause? When I do a normal query, it works > fine....Just using wildcards it does not work.... It works perfectly, you are just to lazy to search for a correct example: http://www.google.com/search?q=sql+l...ldcard+example First link explains it all. -- Daniel Tryba |
|
|||
|
I noticed that Message-ID: <c6m6ki$qfc$2@news.tue.nl> from Daniel Tryba
contained the following: >Jahmil Richardson <jahmil@thehelpesk.com> wrote: >> $query = " Select * From Dispatch Where Customer Like '*A*' "; >> >> Does anyone out there know the syntax that I should be using for the Like >> statement in the Where clause? When I do a normal query, it works >> fine....Just using wildcards it does not work.... > >It works perfectly, you are just to lazy to search for a correct >example: >http://www.google.com/search?q=sql+l...ldcard+example That's unfair. Access databases use the asterisk as a wild card. I've not written a LIKE query with my ODBC setup so I can't help I'm afraid. It may be an idea to try the % though. -- Geoff Berrow (put thecat out to email) It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs http://www.ckdog.co.uk/rfdmaker/ |
|
|||
|
Geoff Berrow <blthecat@ckdog.co.uk> wrote:
>>> $query = " Select * From Dispatch Where Customer Like '*A*' "; >>> >>> Does anyone out there know the syntax that I should be using for the Like >>> statement in the Where clause? When I do a normal query, it works >>> fine....Just using wildcards it does not work.... >> >>It works perfectly, you are just to lazy to search for a correct >>example: >>http://www.google.com/search?q=sql+l...ldcard+example > > That's unfair. Access databases use the asterisk as a wild card. If that is correct, that I appologize to the OP. -- Daniel Tryba |
|
|||
|
Sadly, that IS correct. Access hath its quirks.
IIRC, Access needs the token string to be surrounded by double quotes, so perhaps the OP could try rewriting the query as: $query = 'Select * From Dispatch Where Customer Like "*A*"'; HTH Doug -- Remove the blots from my address to reply "Daniel Tryba" <news_alt.php.sql@canopus.nl> wrote in message news:c6m8hp$rdo$2@news.tue.nl... > Geoff Berrow <blthecat@ckdog.co.uk> wrote: > >>> $query = " Select * From Dispatch Where Customer Like '*A*' "; > >>> > >>> Does anyone out there know the syntax that I should be using for the Like > >>> statement in the Where clause? When I do a normal query, it works > >>> fine....Just using wildcards it does not work.... > >> > >>It works perfectly, you are just to lazy to search for a correct > >>example: > >>http://www.google.com/search?q=sql+l...ldcard+example > > > > That's unfair. Access databases use the asterisk as a wild card. > > If that is correct, that I appologize to the OP. > > -- > > Daniel Tryba > |
|
|||
|
Ooops.. typo..
$query = 'Select * From Dispatch Where Customer Like \"*A*\"'; "8-{ -- Remove the blots from my address to reply "Doug Hutcheson" <doug.blot.hutcheson@nrm.blot.qld.blot.gov.blot.au > wrote in message news:XKUlc.1847$IH5.84692@news.optus.net.au... > Sadly, that IS correct. Access hath its quirks. > IIRC, Access needs the token string to be surrounded by double quotes, so > perhaps the OP could try rewriting the query as: > $query = 'Select * From Dispatch Where Customer Like "*A*"'; > > HTH > Doug > > -- > Remove the blots from my address to reply > "Daniel Tryba" <news_alt.php.sql@canopus.nl> wrote in message > news:c6m8hp$rdo$2@news.tue.nl... > > Geoff Berrow <blthecat@ckdog.co.uk> wrote: > > >>> $query = " Select * From Dispatch Where Customer Like '*A*' "; > > >>> > > >>> Does anyone out there know the syntax that I should be using for the > Like > > >>> statement in the Where clause? When I do a normal query, it works > > >>> fine....Just using wildcards it does not work.... > > >> > > >>It works perfectly, you are just to lazy to search for a correct > > >>example: > > >>http://www.google.com/search?q=sql+l...ldcard+example > > > > > > That's unfair. Access databases use the asterisk as a wild card. > > > > If that is correct, that I appologize to the OP. > > > > -- > > > > Daniel Tryba > > > > |