hyster Posted February 14, 2011 Share Posted February 14, 2011 example of of my table idname file info 14qwerty bat.zip blah when i run the query SELECT * FROM `obarep` WHERE FILE LIKE 'bat.zip' it runs ok but no result is returned. if i use "not like" i get a result. im assuming the . in bat.zip is causing the problems but i dont no were to go from here. i need the file name in the database. Quote Link to comment Share on other sites More sharing options...
mikosiko Posted February 14, 2011 Share Posted February 14, 2011 im assuming the . in bat.zip is causing the problems no, is not..... most likely the field doesn't have exactly 'bat.zip' on it.... use Like with wildcard http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like Quote Link to comment Share on other sites More sharing options...
Maq Posted February 14, 2011 Share Posted February 14, 2011 Maybe this is just an example, but why are you using LIKE with no wild cards? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 14, 2011 Share Posted February 14, 2011 Or, use the equals if you only want exactly that. field = 'bat.zip' Quote Link to comment Share on other sites More sharing options...
hyster Posted February 14, 2011 Author Share Posted February 14, 2011 bat.zip will be a $var when its working but the $var didnt work so i used a fixed term just to get it working. i tried = 'bat.zip' at first as i want an exact match. i then tried 'like' and a few variations but it still would not work. i even tried like 'b' and other single letters and still nothing. i could only get a result using 'not like' Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 14, 2011 Share Posted February 14, 2011 How did the data value get inserted into your table? You likely have a new-line (cr/lf) or a null byte (zero) or even a space stored as part of the data. You will need to find out what is causing the value in your column to not match the expected value you are using in your query. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.