RE: [PHP-DB] adding a space in mysql

From: Date: Wed, 31 Jul 2002 20:46:48 +0000
Subject: RE: [PHP-DB] adding a space in mysql
Groups: php.db 
Request: Send a blank email to php-db+get-20927@lists.php.net to get a copy of this message
I haven't set up any text-based searches before, but when you say: <snip> If the user types 'Wash' I don't want any matches for 'Washington', 'Washing', etc. <snip> Aren't you, in essence, saying that you want to search for "Wash"? Meaning that your query could just say WHERE name = '$var' (where $var is set to "Wash")? According to the MySql manual, the equal comparison operator works on strings and numbers. But maybe text searches work differently than I thought and it will return strings wherever the letter combination "wash" appears. If that's the case I'm sure somebody will correct me and I'll learn something in the process. -----Original Message----- From: ron wallace [mailto:wallace1248@yahoo.com] Sent: Wednesday, July 31, 2002 4:32 PM To: php-db@lists.php.net Subject: [PHP-DB] adding a space in mysql 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 __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#20927) next »