Please forgive me if I'm asking a stupid question! But I really tried hard and still failing I was trying to create an error message that would appear in a loop using PHP The original code looks like this:
// go through lines that had errors
if (property_exists($result, 'return') && is_object($result->return) && property_exists($result->return, 'failed') && $result->return->failed > 0) {
foreach ($result->return->failedRows as $failedRow) {
foreach ($failedRow->errors as $rowErrors)
$message .= "\nline: " . ($failedRow->line) . ", column: " . $rowErrors->column . ", value: '" . $rowErrors->value . "'" . ", message: '" . $rowErrors->details[0]->translated . "'";
}
}
if ($message != "")
throw new Exception('Error details: ' . $message . ' [' . $method . ']');
The error message looks like this right now!

what I'm trying to achieve is to have the error message looking like this:

Again sorry if this seems very simple for any of you but my PHP skills are rather limited and I'm trying to learn all these tricks that may seem very simple to create!
ok here's what I've tried but it's wrong of course!
// go through lines that had errors
if (property_exists($result, 'return') && is_object($result->return) && property_exists($result->return, 'failed') && $result->return->failed > 0) {
foreach ($result->return->failedRows as $failedRow) {
foreach ($failedRow->errors as $rowErrors)
$message .= "<th>Line</th>" .
"<td>" . ($failedRow->line) . "</td>" .
"<th>Column</th>" .
"<td>".$rowErrors->column. "</td>".
"<th>Value</th>" .
"<td>".$rowErrors->value . "</td>" .
"<th>Error message</th>" .
"<td>".$rowErrors->details[0]->translated."</td>";
}
}
if (property_exists($result, 'errors') && is_object($result->errors) && count($result->errors) > 0) {
foreach ($result->errors as $error)
$message .= "\nerror: " . $error;
}
if ($message != "")
echo "<div class='container'><strong>Error details:</strong></br>
<table style='width:100%;'>
<tr>
$message
</tr>
</table></div>;

throwmethod to show your errors then you should take a read up on php.net/manual/en/language.exceptions.extending.php