I have the following query:
//product density
$stmt_density = $conn->prepare("SELECT density FROM product_density
WHERE product_id = :productid ");
$stmt_density->execute(array(':productid' => "$pid"));
$density = $stmt_density->fetchAll();
If density is not present the value will be "NULL".
var_dump($density);
gives following output:
array(1) { [0]=> array(2) { ["density"]=> NULL [0]=> NULL } }
I need to check whether the array is having values or not and to provide select options, if array not empty.