Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.