I am extracting some info from a database using MySQL, I'm sending the result to an Ajax function, and then I display the result on a web page.
Here is my PHP code:
$views = $connection->execute("SELECT profilePic FROM users");
foreach($views as $views)
{
echo "<tr><td><img src='".$views['profilePic']."' /></td></tr>";
}
The warning "Headers already sent" appears because of this part of the code:
<img src='".$views['profilePic']."' />
Which looks like this when parsed:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPgAAAD4CAYAAADB0SsLAAAgAElE [TRUNCATED] ..." >
If I remove the img part, there is no warning:
$views = $connection->execute("SELECT profilePic FROM users");
foreach($views as $views)
{
//this throws no warning:
echo "<tr><td></td></tr>";
}
Who exactly is triggering the warning? What rule is being applied?