Conditional image on grid - Error Array to String Conversion

Trying to do this:
https://forum.scriptcase.net/forum/developers/hot-tips/685-conditional-image-in-a-grid

The field ‘attachments’ is a text field. On record I am doing this:

// Check for record
$check_sql = “SELECT COUNT(*) FROM bbw_files WHERE parent_id = ‘{note_id}’” ;
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]})) // Row found
{
$attached_file_count = {rs[0][0]};
}
else // No row found
{
$attached_file_count = ‘’ ;
}

{attachments} = $attached_file_count ;

if ($attached_file_count >= ‘1’) {
{attachments} = “<img src=’…/_lib/img/scriptcase__NM__ico__NM__paperclip_16.png’/>” ;
} else {
{attachments} = ‘’ ;
}

When I run the application, I get “Error - Array to String conversion”. I have also tried “Check for an existing record” and get the same thing.

see array_filter, it may be useful

I did figure it out … don’t remember how … but thank you.

php 7 doesn’t like count on null values
look there, often problem is in array, null value or " ",
array_filter give you a fresh array whitout null or values " "
https://www.w3resource.com/php/funct…ray_filter.php

Now that you say that, it might have been null values