Question

Locked

PHP with Access ODBC

By branty1970 ·
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.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Like ' A%' is what you want in compliant SQL. <NT>

by Tony Hopkinson In reply to PHP with Access ODBC
Collapse -

Perfect! Thank you very much.

by branty1970 In reply to Like ' A%' is what you wa ...

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!

Collapse -

Yeah well that's access leading you up the garden path

by Tony Hopkinson In reply to Perfect! Thank you very m ...

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.

Back to Networks Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums