in reply to Re^2: Searching a text file
in thread Searching a text file

Why would you *want* to search for a string in any field? You last field looks like a boolean (on off) your 4th field looks boolean too (male female). If you are searching for emails you would not really want to look there....

Presumably you have a data entry form. This can also be a search form, just add a button that says search. When a user enters data in one or more fields and clicks search all you do is make a query like:

$sth = $dbh->prepare('SELECT foo,bar,baz FROM widget WHERE foo=? AND b +ar=? AND baz=?'); $sth->execute($foo,$bar,$baz);

where you dynamically construct the WHERE clause depending on how many fields the user enters data into. To search *all* the fields for the one string the syntax would simply be OR, not AND and include all the fields you want to search.....

$sth = $dbh->prepare('SELECT foo,bar,baz FROM widget WHERE foo=? OR ba +r=? OR baz=?'); $sth->execute($str,$str,$str);

DBD::SQLite might suit you better.

cheers

tachyon