Re: php query for mysql table
| From: | Gianluca Baldo | Date: | Mon, 20 Aug 2001 10:29:11 +0000 |
| Subject: | Re: php query for mysql table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63483@lists.php.net to get a copy of this message | ||
You should use the "like" clause whch allows the use of wild cards %
and ?.
Have a look at the MySQL manual, it should be explained there.
HTH
Gianluca
WS> I am a newbie to php + mysql and wanted to ask for some help on a
WS> particular item which I can't seem to find "the right key" in the
WS> documentation. I am trying to set up a simple Q&A system with an entry
WS> page where one can select to either have all questions & answers from a
WS> mysql database displayed or else search with a text field for only
WS> those questions which contain a certain word(s).
WS> Can someone tell me how to set in a query when trying to find records
WS> in a mysql table that have a certain word or perhaps 2 or 3 words
WS> (among others) ...?
WS> I know about using SELECT and WHERE in order to find records which
WS> match *exactly*, but am looking for something a bit different ...
WS> Example:
WS> The values of 3 records for the "question" field of the database might
WS> be the following:
WS> [1] How do you deal with anger?
WS> [2] Ever been full of anger in your life?
WS> [3] Is life always easy?
WS> How can I set a PHP query with SELECT and WHERE to express the
WS> following:
WS> Which questions contain the word "life"? That is, have someone search
WS> the database in the "question" field for records where the word "life"
WS> is used as part of the question ... The result then should return the
WS> records 2 & 3 above
WS> Any help is greatly appreciated. Thanks mucho.
WS> God bless you with His grace and peace
WS> Wolfgang
WS> Looking for Biblical information? COME AND SEE!
WS> -- ONLINE Courses: http://classes.bibelcenter.de ... NEW!
WS> -- BibelCenter: http://www.bibelcenter.de
WS> -- Bookstore: http://www.worthy.net/BibelCenter/
gianluca.baldo@bcninedita.com
BcnInédita
EURO RSCG INTERACTION
www.bcninedita.com
Planella, 39
08017 Barcelona
Tel.34 932 531 950 (directo 93 253 19 53)
Fax. 34 932 114 546