Question: How to store data from database in a variable in `PHP`. because the data I want to use that many times in my project. like:

```
foreach ($data as $value) 
{
    $Table = '
        <TR>
            <TD>' . $value['name'] . '</td>
            <TD>' . $value['date'] . '</TD>
            <TD>' . $value['time'] . '</TD>
        </TR>';
}

echo $Table;

```

Now I am getting only the first row of the result, it's not looping proprly. Help me to fix this.
Thanks in advance..

Answer: 
```
foreach ($data as $value){
    $table.='

      <tr>

           <td>'.$value['name'].'</td>
           <td>'.$value['date'].'</td>
            <td>'.$value['time'].'</td>

      </tr>';
}
echo $table;

```
Please take a look to below code, I have made some modification and hope this will help you. 

```
$Table = "<table name='data' id='data'>"; 

    foreach ($data as $value){

     $Table .= "<tr>";
     $Table .= "<td>".$value['name']."</td>";
     $Table .= "<td>".$value['date']."</td>";
     $Table .= "<td>".$value['time']."</td>";
     $Table .= "</tr>";

                                 }
$Table .= "</table>";
    echo $Table;

```