Not sure what should be the title for this case, please edit if you have a suitable title for it. See below for the exact question.
MySQL Database:
Now I want to check if the value option in “Right_Option” is having value or not. (As per above, it is not having as Right_Option is “C” & Option_C is not having any value.)
My Code:
$option = "$row['Option_".$right_option."'];"; if($option != ''){ //Other Codes } else{ //other codes }
It gives me an error:
Advertisement
Answer
You are using it wrong. Use this instead:
if(isset($row["Option_".$right_option]) && $row["Option_".$right_option] !== ''){ //Other Codes } else{ //other codes }