Re: Another newbie question
| From: | (Wolfgang Ebneter) | Date: | Tue, 07 Sep 2004 17:00:29 +0000 |
| Subject: | Re: Another newbie question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36093@lists.php.net to get a copy of this message | ||
Am Montag, 6. September 2004 23:50 schrieb Pete Holsberg:
[...]
> $sql = "SELECT * FROM $table ";
> $sql .= "WHERE
Attachment: [application/pgp-signature] signature
LastName LIKE $search_string ";
> $sql .= "OR FirstName LIKE $search_string ";
> $sql .= "OR Spouse LIKE $search_string ";
> $sql .= "OR Street LIKE $search_string ";
> $sql .= "OR Email LIKE $search_string LIMIT 0, 30 ";
> $sql .= "ORDER BY Street, HouseNum, LastName";
How about
$search_string .= $search_string . "%";
$sql = "SELECT * FROM $table ";
$sql .= " WHERE LastName LIKE '$search_string' ";
$sql .= " OR FirstName LIKE '$search_string' ";
$sql .= " OR Spouse LIKE '$search_string' ";
$sql .= " OR Street LIKE '$search_string' ";
$sql .= " OR Email LIKE '$search_string' LIMIT 0, 30 ";
$sql .= " ORDER BY Street, HouseNum, LastName";
> $result = mysql_query($sql)
> or die ("Couldn't execute query.");
> ...
>
> -------------
>
> Why is that?
>
> Also, how do I make LIKE insensitive to case?
As far as I know LIKE is case insensitve.
> And finally, how do I use the % wildcard with a variable?
See above.
You're welcome
--
Wolfgang Ebneter
MSc. Data Engineering
Fingerprint : 9C66 28A8 7AD8 BA59 6CBB 055C D664 D8FA 8CBA 800C
Key-Server : wwwkeys.eu.pgp.net
Attachment: [application/pgp-signature] signature