Sideclef Posted August 12, 2008 Share Posted August 12, 2008 How do I stop my Data base from producing negative numbers I would like it to stop at 0 Link to comment https://forums.phpfreaks.com/topic/119303-solved-negative-numbers/ Share on other sites More sharing options...
akitchin Posted August 12, 2008 Share Posted August 12, 2008 depends on the code putting it in, but the quickest dead-stop way of doing so is by setting the column attribute to UNSIGNED. this can be done through PMA or a MODIFY statement, but i would be wary in the case that you have pre-existing negative integers; not sure how MySQL would react if that was the case. Link to comment https://forums.phpfreaks.com/topic/119303-solved-negative-numbers/#findComment-614538 Share on other sites More sharing options...
Sideclef Posted August 12, 2008 Author Share Posted August 12, 2008 So if I changed all the negs to 0 then changed it. Would it be ok should I use just UNSIGNED or UNSIGNED ZEROFILL Link to comment https://forums.phpfreaks.com/topic/119303-solved-negative-numbers/#findComment-614543 Share on other sites More sharing options...
akitchin Posted August 12, 2008 Share Posted August 12, 2008 UNSIGNED is fine; zerofill will add zeroes up to the field's length, and often just makes things more of a pain unless you need them for your specific application. you can either set them to zero or take their absolute values - it sounds as though you would just want to set them to zero. Link to comment https://forums.phpfreaks.com/topic/119303-solved-negative-numbers/#findComment-614665 Share on other sites More sharing options...
Sideclef Posted August 12, 2008 Author Share Posted August 12, 2008 Thanks a lot much appreciated Link to comment https://forums.phpfreaks.com/topic/119303-solved-negative-numbers/#findComment-614671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.