Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

phpmyadmin no negative numbers

Is there a way in phpmyadmin to set a field in mysql to be 0 if the result is less than 0? I'm trying to determine how long to pay off my credit card. If the time remaining is a negative number i'd like that field to be 0. Any suggestions anyone?
0
gatormrr3
Asked:
gatormrr3
2 Solutions
 
Frosty555Commented:
You can create a view or a query with a custom column, set to something like

IF(myfield>0,myfield,0) AS myfieldnonegative

then when you select from that view, or execute that query, the resulting recordset will have a column "myfieldnonegative" which will be the result you're looking for.
0
 
Ray PaseurCommented:
"...  if the result is less than 0?"

If what result is less than zero?
0
 
Shinesh PremrajanTechnical ManagerCommented:
Define that field as unsigned integer.

Hope this helps
0
 
gatormrr3Author Commented:
The code worked as well but the unsigned method was simpler and more error proof. Thanks
0

Featured Post

Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now