I'm working on a website right now. It has a table that displays various information from a database. The loop that populates the table looks like this:
<h3>HEADER</h3>
<table border="1">
<th>UserID</th>
<th>Title</th>
<th>Description</th>
<th>Start</th>
<th>End</th>
<th>FileUploadId</th>
<th>FileName</th>
<?php
foreach ($result as $a) {
echo "<tr><td>" .
$a[UserId] . "</td>" .
"<td>" . $a[Title] . "</td>" .
"<td>" . $a[Description] . "</td>" .
"<td>" . $a[Start] . "</td>" .
"<td>" . $a[End] . "</td>" .
"<td>" . $a[Files][0][FileUploadId] . "</td>" .
"<td>" . $a[Files][0][FileName] . "</td></tr>";
}
?>
This $result is just a decoded JSON file. So, all of the above works. The JSON file is indexed like so
- Files
- FileUploadId
- FileName
- FileData
- Title
- Description
- etc.
I'm trying to figure out how to populate the table with "FileData" in a similar way to how I am with "FileName" and "FileUploadId." However, those two fields are just text, where as FileData is a base_64 string that represents an image... so how can I decode this string and place the image into the table data? Any advice is appreciated.