I want to give out a for every line in my database.
It seems that it is working but only returns the first column.

![screenshot](https://i.stack.imgur.com/HMXQw.png)
**Note: There are values for the empty fields in database!** 

```
$columns = "Ticket, Last_Modified_Date, Requester";

```

Heres my code:

```
    function getTicket($columns){
    echo($columns);
    global $db_host, $db_name, $db_user, $db_pass;
    $db = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8", "$db_user", "$db_pass");
    $result = $db->prepare("SELECT $columns FROM tickets");
if ($result->execute()){
    echo("<b>Successfully!</b><br><br>");

    $rows = $result->fetchAll(PDO::FETCH_ASSOC);
    $col_names = explode(',', $columns);
foreach($rows as $row){
    echo("<tr>");
foreach($col_names as $col_name){
if (!isset($row[$col_name])){
    continue;
    }
    echo("<td>".$row[$col_name]."</td>");
    }
    echo("</tr>");
        }
    }
else{
    echo("<b>FAILED!</b><br><br>");
    }
    $db = null;
}

```