kernelgpf Posted December 5, 2006 Share Posted December 5, 2006 Subject says it all. I need help quickly, I've got a project due at 2, and just came across a strange problem. When I try to insert a number into the DB, say "009909" or something, if there are "0"s before it, it deletes them automatically and inserts the remaining number into the DB. I DON'T want it to do this, how can I stop it? Link to comment https://forums.phpfreaks.com/topic/29545-simple-problem-00s-wont-show-up-before-other-numbers-when-added-to-db/ Share on other sites More sharing options...
drifter Posted December 5, 2006 Share Posted December 5, 2006 change it from a int field to a char or varchar - or add the 00's back when you get the number out of the db Link to comment https://forums.phpfreaks.com/topic/29545-simple-problem-00s-wont-show-up-before-other-numbers-when-added-to-db/#findComment-135568 Share on other sites More sharing options...
Wuhtzu Posted December 5, 2006 Share Posted December 5, 2006 What type of field are you using to store the numbers? int, varchar, text ect.??If the 0's in front of your number is used to ensure the numbers are sorted in numeric order you could just used a field which is an "int". It handles numbers correctly. Like 10 is lager than 2 ect. Link to comment https://forums.phpfreaks.com/topic/29545-simple-problem-00s-wont-show-up-before-other-numbers-when-added-to-db/#findComment-135569 Share on other sites More sharing options...
kernelgpf Posted December 5, 2006 Author Share Posted December 5, 2006 I was using BIGINT, I changed it to varchar, it works now. Thanks guys. ^^ Link to comment https://forums.phpfreaks.com/topic/29545-simple-problem-00s-wont-show-up-before-other-numbers-when-added-to-db/#findComment-135571 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.