Re: how to do query on partial field contents ???
| From: | Andy Armstrong | Date: | Tue, 24 Feb 2004 18:37:30 +0000 |
| Subject: | Re: how to do query on partial field contents ??? | ||
| References: | 1 2 | Groups: | php.db php.db |
| Request: | Send a blank email to php-db+get-33104@lists.php.net to get a copy of this message | ||
Frank Flynn wrote:
And if you'd like to make wild carding optional keep your code the way it is:And bear in mind that there's could be a nasty SQL injection problem with that code if $_GET['search'] hasn't been SQL escaped in some way. -- Andy Armstrong, Tagish$query .= " ANDAnd put a comment on the web page "Use the % for wild cards". The thing about:modelLIKE '".$_GET['search']."'";$query .= " ANDIs it will return many results if $_GET['search'] is very small like one letter.modelLIKE '%".$_GET['search']."%'";