I want to add these images from my server to an JavaScript array so I can work with them.
The example below should alert the number of images in the folder. At the moment there is two images in there and this script alerts me twice saying I've the length of the array is one. Obviously I want one alert saying two.
<?php
include("mysqlconnect.php");
$select_query = "SELECT `ImagesPath` FROM `offerstbl` ORDER by `ImagesId` DESC";
$sql = mysql_query($select_query) or die(mysql_error());
while($row = mysql_fetch_array($sql,MYSQL_BOTH)) {
?>
<script> var images = new Array("<?php echo $row["ImagesPath"]; ?>");
alert(images.length);
json_encode()var images = <?php echo json_encode($yourArray); ?>;