jjmusicpro Posted July 17, 2007 Share Posted July 17, 2007 ok i have a weird problem, i have a database that holds zipcodes, and some zipcodes are say 08888 however when they are entered in the DB they are 8888, so if someone enters 08888 into my search it wont find it. The colume is a varchar, can anyone help? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 17, 2007 Share Posted July 17, 2007 dude remember this any zero at the left is disregarded by your db so you will always have this 00000000000000000001 will always 1 when vied Quote Link to comment Share on other sites More sharing options...
jjmusicpro Posted July 17, 2007 Author Share Posted July 17, 2007 so why wont it appear when i search for 08888? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 18, 2007 Share Posted July 18, 2007 because i told you it will be treated as 0000001 = 1 so search for 1 Quote Link to comment Share on other sites More sharing options...
jjmusicpro Posted July 18, 2007 Author Share Posted July 18, 2007 how do the search engines that look for zipcodes that begin with 0 work right now? They seem to find ones that begin with 0 Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 18, 2007 Share Posted July 18, 2007 If it's a varchar field, then whatever you enter should be placed in the database. I suspect that somewhere between the form and the insert you've treated your input as a number not a string Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 18, 2007 Share Posted July 18, 2007 declare the field type as varchar or char and it accept 00008 not not be treated as 8 Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 18, 2007 Share Posted July 18, 2007 declare the field type as varchar or char and it accept 00008 not not be treated as 8 @teng84 - from the first post ... The colume is a varchar, can anyone help? 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.