Jump to content

check if field shows 0


Recommended Posts

Hi everyone,

I'm trying to stop the programming to subtract more that will go to below from 0, I set up the unsigned in phpmyadmin, but it went sentence error if it come to -1 or below. I mean, if start with 3 or 4, then subtract by 1, till reach 0, then stop, I need something that can ignore program to subtract if it reach 0.

for example:

$sql = $GaryDB->prepare("SELECT howMany from bracelets");

$check = $sql->execute;

if($check->rowCount() == 0) {
No program in this function
} else {
do program

Get it? How you do that?

Edited by Sigmahokies
Link to comment
Share on other sites

Posted (edited)

No, that is not what I mean.

I mean if there is 0 in field, do nothing. if more than 0, do something. I tried to put null, but it doesn't work. I need something method that do nothing to prevent message error in browser, because I put unsigned in field in the database. I put do something after else because it's not 0 in field. for example, In switch system, this method "break;" can stop the function. Now, I need something method to stop function when it comes to 0.

Edited by Sigmahokies
Link to comment
Share on other sites

??? thats what it does? I suggest you use an array to store values, with an extra storage of currentcount, use that to check if zero or above. If you look through database field it will return to original value each time. You can also set a default value of 0.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...