Re: adding a space in mysql
| From: | Adam Royle | Date: | Wed, 31 Jul 2002 22:44:02 +0000 |
| Subject: | Re: adding a space in mysql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20932@lists.php.net to get a copy of this message | ||
I think the other replies to this are missing the point.
You want to search a text field for the word Wash, and want to put the space in so you can search
with the space, eliminating words which begin with wash. But then, if you think about it, that means
you'd have to search for commas, and full stops. I don't think this is such a good way to
do it. Try using regular expressions. I have never used regex on a db before, but I have seen a few
people mention it. Have a go and if you find a solution, post it.
Adam
--- Original Message ---
How can I add a space to the end of a varchar string
in mysql? I can't seem to do it directly, and I tried
str_pad and other things, but no luck so far. The db
doesnt hold the value of the space...its getting
trimmed somewhere(?)
The reason I want to do this is so I can search for
exact matches on one word strings without stemming:
...WHERE name LIKE '$var %'.
If the user types 'Wash' I don't want any matches for
'Washington', 'Washing', etc.
Thank You All