adding a space in mysql

From: Date: Wed, 31 Jul 2002 22:49:44 +0000
Subject: adding a space in mysql
Groups: php.db 
Request: Send a blank email to php-db+get-20933@lists.php.net to get a copy of this message
thanks, helpers, but I think I have a simple solution: I will insert a space at the front of the string, where the db must accept and retain it. BTW, here is the SQL I am working with: ////////////////////////////////////////// elseif ($desc==desc) { $sql="SELECT bandid, bandname, bandesc, bin_id, genre FROM bands, genre WHERE (bands.genreid=genre.genreid) AND "; while (list($key, $word)=each($wordsarray)) //$wordsarray from textbox input { $sql=$sql."(bandname LIKE '$word %' OR bandname LIKE '% $word %' OR bandname LIKE '% $word' OR bandesc LIKE '$word%' OR bandesc LIKE '% $word %' OR bandesc LIKE '% $word' OR genre LIKE '$word%' OR genre LIKE '% $word') AND "; } $sql=substr($sql, 0, (strlen($sql)-5)); $sql=$sql." ORDER BY genre.genre ASC, bandname ASC"; } /////////////////////////////////////////////////// If I do "bandname='$var' I would not hit the band 'Red Letter Day' if the user jusr types 'red'. __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com

« previous php.db (#20933) next »