Question Locked

PHP with Access ODBC

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a simple PHP based website with an ODBC connection to an Access database. I want to query the database to find all contacts whose lastname begins with the letter A. This command works in Access but won't work through the ODBC connector. Anyone got any suggestions as to how I could make it work?

SELECT * FROM Contacts WHERE LastName Like 'A*'

I've also tried to more correct SQL version:

SELECT * FROM Contacts WHERE LastName BEGINS WITH 'A' but not surprisingly that fails because the BEGINS WITH command isn't supported by MS.

I'm using PHP 5, IIS 6, Windows Server 2003 and an Access 2002 database. All latest patches and fixes are installed for Windows and IIS.

Thanks,
Martin.

4 replies

by branty1970

Thanks for that Tony. I've been tearing my hair out trying to figure this one out. Why is it you can never find the answer documented when you need it!

by tony hopkinson

If uoi are looking up sql for it start don't mention access in the search string, it uses all sorts of vb extension and enhancements.

Best bet is to put SQL 92 and then whatever SQL you want to know about, that way you'll get an answer that should work with pretty much all databases.

SQL through ODBC doesn't like proprietry twists as it's meant for any DB that claims it.

This discussion is closed to new replies.