![]() |
|
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread |
|
|
PM User | #1 |
|
Regular Coder ![]() Join Date: Jun 2003
Location: Australia
Posts: 506
Thanks: 6
Thanked 7 Times in 7 Posts
![]() |
Negative value in a table
Hiya,
I am trying to enter a value in a field set to INT(11), but it will not allow negative numbers. What should this field be to allow such a value? Thanks in advance! Taylor. |
|
|
|
|
|
PM User | #2 |
|
Regular Coder ![]() Join Date: Dec 2003
Location: Carrot River, Saskatchewan
Posts: 677
Thanks: 3
Thanked 2 Times in 2 Posts
![]() |
varchar should be able to hold the value... then when you retrieve it just do a simple math problem to verify you want it an integer.
Example PHP: PHP Code:
|
|
|
|
|
|
PM User | #3 |
|
Regular Coder ![]() Join Date: Oct 2002
Posts: 379
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
Alternatively, you could check the variable definition. It's likely to be defined as UNSIGNED. Note that mySql automatically adds the unsigned property to any field set to ZEROFILL: zerofill is really designed for index columns (keys and foreign keys), where a negative number doesn't make any sense
Putting numberical values in a char field is both wasteful and inefficient. If all else fails, you might want to take a look through the manual.
__________________
Strategy Conscious |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Rate This Thread | |
|
|