I am trying to retrieve data from a query result. Now what I am trying is that if a question has no images, then just output a blank, else if a question does have image(s), then output the image using an image tag. Only problem though is that it keeps outputting Array.
Where am I going wrong?
<?php foreach ($arrQuestionId as $key => $question) { ?>
<div class='lt-container'>
<p><?php echo htmlspecialchars($arrQuestionNo[$key]) . ": " . htmlspecialchars($arrQuestionContent[$key]); ?></p>
<?php
//start:procedure image
$img_result = '';
if (empty($arrImageFile[$key])) {
$img_result = ' ';
} else {
?>
<p>
<img alt="<?php echo $arrImageFile[$key]; ?>" height="200" width="200" src="<?php echo $arrImageFile[$key]; ?>">
</p>
<?php
}
//end:procedure image
?>
</div>
<?php } ?>
1 Answer