Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access ODBC Query Problem

Status
Not open for further replies.

ScottCybak

Programmer
Sep 29, 2000
48
CA
Hello, i'm trying to run a simple search query, but am running into problems while creating the Sql string.

In access:

WHERE [RefNum] Like '*asdf*'

works perfectly, but when i create the string in PHP and access via odbc_exec it fails:

WHERE [RefNum] Like '*$strWhat*'

sadly, if i echo the sql and paste the php query into access it works perfectly as it should. I tried using \" (escaped double quotes) but for some reason access rejects them and the odbc_exec gives me an error. Access usually prefers " over 's.

So, Like "*asdf*" would be Like \"$strWhat\"

This isn't working - is there something i'm missing? Scott Cybak
Nighthawk Transport Inc.
 
Well, i managed to figure out that the wildcard for the access odbc driver is a % rather then the native access * Scott Cybak
Nighthawk Transport Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top