I have a database table where up to 50% of the fields in any row may be blank or NULL. The blank fields vary from row to row. The contents of the fields are strings. I want to obtain a PHP array containing the strings from a row.
I could, I suppose, create the array from all the fields and then weed out the blanks, but I wonder if there’s a way in MySQL to SELECT only those fields with content. I can’t name the fields in the query because I don’t know in advance which row will selected and so don’t know which fields won’t be blank.