Searching in Access

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
terji
Forum Commoner
Posts: 37
Joined: Tue May 14, 2002 5:27 pm
Location: Denmark

Searching in Access

Post by terji »

I'm having a funny problem with a search function searching a Access 2000 database.

The problem is this SQL sentence:
$sql = "SELECT DISTINCTROW * FROM news WHERE ((news.title) Like '*" . $search . "*') ORDER BY news.title, news.author;";
It works fine when executed directly in Access but through the ODBC I just recieve an empty recordset. If I remove the [*] before and after the search criteria and type the exact title I get the results. Can't I use * via ODBC?

Can anyone help me with this?
smesquita
Forum Newbie
Posts: 7
Joined: Wed Oct 23, 2002 5:53 am

Post by smesquita »

In access by ODBC I always use % insted of *:

like '%word%'

Try it :!:
terji
Forum Commoner
Posts: 37
Joined: Tue May 14, 2002 5:27 pm
Location: Denmark

What about indexing??????

Post by terji »

If I create an index in the DB to speed up searches, do I then have to change my search sql sentence :?:
smesquita
Forum Newbie
Posts: 7
Joined: Wed Oct 23, 2002 5:53 am

Post by smesquita »

No. If you create an index, the conceptual data will not be changed, only the way the data is stored in files are changed (to speed up the search)
Post Reply