I have a bookmarks page where images are displayed. The images are being displayed fine however above the images, the array which the images are retrieved from is also displayed such as:
[["1", "img/exampleImage1.png"], ["2", "img/exampleImage2.png"]]
How can I avoid showing this text array but still keep my images?
This is the bookmarks page
<?php include 'retrieveSymbol.php';?>
<div id="bookmarkedSymbols"></div>
<script>
//populates product container
$.getJSON("retrieveSymbol.php", function(data){ //retrieves json array
$.each(data, function(i, field){ //loops through array
$("#bookmarkedSymbols").append(
//creates product box filling it with data
"<img src='" + field[1] + "'" + "id='symbol' alt='stadium'></a>"
);
});
});
</script>
This is the retrieve symbol page :
<?php
//connect to the database
$mysqli = NEW MySQLi ('localhost','root','','bookmarkedSymbols');
//query database
$resultSet = $mysqli->query("SELECT * FROM symbols");
//count the rows
if($resultSet->num_rows != 0) {
//turn the results into an array
$rows = $resultSet->fetch_all();
echo json_encode($rows);
}else{
echo "{no connection}";
}
?>