Jump to content

"" blank field?


Bickey

Recommended Posts

I'm confused...

 

how do you say check if the field in MYSQL is blank? it's not getting what I'm attempting to get. Please help.

 

I want to do actionA... if either of these 3 conditions are true

tf1=="RED"

tf1==""

tf2=="" AND tf=="apple"

 

 

if(tf1=="RED" or tf1=="" or tf2=="" AND tf=="apple")
{
do actionA...
}

Link to comment
https://forums.phpfreaks.com/topic/226268-blank-field/
Share on other sites

how do you say check if the field in MYSQL is blank? it's not getting what I'm attempting to get. Please help.

 

How do you know?  Did you output any of these variables to see what the actual value is?

 

As far as your logic, I think you want:

if((tf1=="RED" or tf1=="" or tf2=="") AND tf=="apple")

Link to comment
https://forums.phpfreaks.com/topic/226268-blank-field/#findComment-1167996
Share on other sites

the variables output is correct. But I think my code is causing problems.

 

when I test with the first 2 conditions it works but when I add the 3rd condition it doesn't give the desired output. ... in the 3rd condition I want check if tf2 is blank AND tf says apple (both should be true in the 3rd condition).

Link to comment
https://forums.phpfreaks.com/topic/226268-blank-field/#findComment-1168001
Share on other sites

the variables output is correct. But I think my code is causing problems.

 

when I test with the first 2 conditions it works but when I add the 3rd condition it doesn't give the desired output. ... in the 3rd condition I want check if tf2 is blank AND tf says apple (both should be true in the 3rd condition).

 

Then you have to group the logic together with parentheses:

if(tf1=="RED" or tf1=="" or (tf2=="" AND tf=="apple"))

Link to comment
https://forums.phpfreaks.com/topic/226268-blank-field/#findComment-1168015
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.