Again, though, none of that code has any PDO in it at all.
What happens in your original code that is undesirable? And why do you deal with the “note” column twice in the new code, but only once in the original code?
if(trim( . $students[0]['note'] . )=='') {printf ("");} else {printf (" [<b> ". $students[0]['note'] ." </b>]");}
printf("<p class='gray box'>" . $students[0]['note'] . "</p>\n
For future posts, could you just post the section that’s different please? It’s quite tricky to see where it varies when you put the whole block.