I have an HTML tag here :
The output from your code was putting
tags inside the src attribute of the tag.
That by definition doesn't work in HTML. If everything else was right, this should work:
0 ) {
$array = array_splice($array, 0, $limit);
}
return $array;
}
function render_images() {
global $stmt3;
$output = '';
if ($count = sqlsrv_num_rows($stmt3) > 0) {
while ($recentBadge = sqlsrv_fetch_array($stmt3)) {
$result[] = $recentBadge;
}
if ($count > 3) {
$result = get_random_elements(result, 3);
}
foreach ($result as $recentBadge) {
$output .= $recentBadge['BadgeName'];
$output .= '
';
$output .= '
';
}
} else {
$output = 'no results';
}
return $output;
}
?>
As a tip: please try to keep your code separated, the logic separated from the view.