I want to add two values from two rows to an array. One is a path and the other is a tag. I'm then encoding the array. So I can display the image and then I'm going to using the tags to order the new javascript array dynamically. I would like "echo $data;" to say something like [{path, tag}, {path, tag}]
<?php
include("mysqlconnect.php");
$select_query = "SELECT `ImagesPath`,`Tag` FROM `offerstbl` ORDER by `ImagesId` DESC";
$sql = mysql_query($select_query) or die(mysql_error());
$data = array();
while($rows = mysql_fetch_array($sql,MYSQL_BOTH)){
$data[] = $rows['ImagesPath']['Tag'];
}
echo json_encode($data);
echo $data[0];
?>