<https://forums.phpfreaks.com/topic/309892-how-to-fetch-the-filename-on-split/>
<http://schema.org/text>
"Hi all,\n \n\n\n\tI am working on the PHP to fetch the data from the database. I would like to fetch the filename only following by:\n \n\n\nemail1.png\nemail2.png\nemail3.png\nmy_inbox.png\n\n\n\t \n \n\n\n\tWhen I try this:           \n \n\n\n$mailbox_sql = 'SELECT * FROM ' . $mailfolder . ' WHERE email_id = ? AND message_id = ?';\n$mailbox = $link-&gt;prepare($mailbox_sql);\n$mailbox-&gt;execute([$id,$message_id]); \n\n// set the resulting array to associative\n$row = $mailbox-&gt;fetch(PDO::FETCH_ASSOC);\n\nif (is_array($row)) {\n   $attached = $row['attached_files'];\n   $attached_files_name = explode('attid: ', $attached);\n}\n\n\n\t \n \n\n\n\t \n \n\n\n\tI am getting this:\n \n\n\n0 filename: email1.png\n1 filename: email2.png\n2 filename: email3.png\n3 filename: my_inbox.png\n\n\n\t \n \n\n\n\t \n \n\n\n\tHere is what I have stored in the database:\n \n\n\n attid: 0 filename: email1.png\n attid: 1 filename: email2.png\n attid: 2 filename: email3.png\n attid: 3 filename: my_inbox.png\n\n\n\t \n\t \n \n\n\n\t \n \n\n\n\tHere is what I want to achieve:\n \n\n\nemail1.png\nemail2.png\nemail3.png\nmy_inbox.png\n\n\n\t \n \n\n\n\t \n \n\n\n\tCan you please show me example how I could get the filename when I am fetching the data from the database?\n \n\n\n\tThanks in advance.\n \n"
<https://forums.phpfreaks.com/topic/309892-how-to-fetch-the-filename-on-split/?tab=comments>