Re: confused over where/like/select commands
| From: | cmoewes at moewes dot com | Date: | Mon, 14 Aug 2000 15:01:39 +0000 |
| Subject: | Re: confused over where/like/select commands | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-11622@lists.php.net to get a copy of this message | ||
Basically what you want to do is this
SELECT * from table where columna like '%$formvalue%' or columnb like
'%$formvalue%' or columnc ...
you get the idea. The % in the like statement is a wildcard character
and needs to be before and after the keyword to search.
On Mon, Aug 14, 2000 at 04:16:30PM +0000, Cameron May wrote:
> Dear folks
> I am trying to figure out some way of displaying information from a
> MYSQL table but to only display the records that contain the
> words that are typed into a web-form and submitted. This must be
> in any part of any column in the table called 'psyweb'.
>
> I have tried naming the words submitted by the form as $keyword
>
> I have tried using the WHERE and LIKE commands, but am
> unclear as to how to get these to work each time by using the text
> that each person puts into the web-form.
>
> all I can get the moment are all the results from a basic mysql
> query as in PHP Essentials, I have also scoured PHP pocket
> reference and the O'Reilly MYSQL reference book - but am
> swimming around in circles in a sea of confusion!!
>
> If anyone can fling some clear examples or definitions my way, that
> would be lovely!!
>
> Many Thanks
> Cameron
>
>
> Give a man a fish; you have fed him for today. Teach a man to use
> the Net and he won't bother you for weeks.
> -Author unknown
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
Christopher R. Moewes-Bystrom
cmoewes@moewes.com
http://www.moewes.com
http://www.linuxnovice.org