Re: Select all that contains in MySql
| From: | Adam Voigt | Date: | Thu, 03 Apr 2003 15:56:53 +0000 |
| Subject: | Re: Select all that contains in MySql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142162@lists.php.net to get a copy of this message | ||
Try:
$query = "SELECT * FROM software_assets WHERE $searchType LIKE
'$search%' ";
Note the percent sign, this is equivalent to a wildcard (* for
instance).
On Thu, 2003-04-03 at 10:53, Mike Tuller wrote:
> I have built a search function that searches a table for all items that
> match what you enter into the search field. I would like it to return
> all items that contain a certain string rather that matches. For
> example, I want to have it so that if I enter M in the search field, it
> will return all items that start with M.
>
> Here is what I have so far.
>
> $query = "SELECT * FROM software_assets WHERE $searchType LIKE
> '$search' ";
>
> Thanks,
> Mike
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Adam Voigt (adam@cryptocomm.com)
Linux/Unix Network Administrator
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc