Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 539 characters in body; added 183 characters in body
Source Link
Tatu Ulmanen
  • 125.1k
  • 34
  • 190
  • 185

That means that debamt was empty. Empty is not a correct integer value.

You know, you could also use the || logical operator, which means OR. Because this row:

if (empty ($debamt) && empty ($debdes) && empty ($cramt) && empty ($cramt)) die ("$cberror"); 

...means that if even one of those values is NOT empty, the if clause will not fire. What you probably want is:

if (empty ($debamt) || empty ($debdes) || empty ($cramt) || empty ($cramt)) die ("$cberror"); 

That way, if one of the fields is empty, the script will not continue. This also makes a lot of your consequent checks useless.

Because of your current code, it is completely possible that $debamt gets through as empty. I'd engourage you to think your if clauses through and see what's really necessary.

That means that debamt was empty. Empty is not a correct integer value.

That means that debamt was empty. Empty is not a correct integer value.

You know, you could also use the || logical operator, which means OR. Because this row:

if (empty ($debamt) && empty ($debdes) && empty ($cramt) && empty ($cramt)) die ("$cberror"); 

...means that if even one of those values is NOT empty, the if clause will not fire. What you probably want is:

if (empty ($debamt) || empty ($debdes) || empty ($cramt) || empty ($cramt)) die ("$cberror"); 

That way, if one of the fields is empty, the script will not continue. This also makes a lot of your consequent checks useless.

Because of your current code, it is completely possible that $debamt gets through as empty. I'd engourage you to think your if clauses through and see what's really necessary.

Source Link
Tatu Ulmanen
  • 125.1k
  • 34
  • 190
  • 185

That means that debamt was empty. Empty is not a correct integer value.