-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.php
More file actions
34 lines (30 loc) · 992 Bytes
/
Copy patharray.php
File metadata and controls
34 lines (30 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
## Turn on error reporting
error_reporting(-1);
ini_set('display_errors', 'On');
$valueMap = array();
// session_start();
include_once('connection.php');
$sql = "SELECT `song_url`, (`song_id`-1) AS `song_id`, `song_name`, `artist`,`poster` FROM `song_list` GROUP BY `song_id` ASC";
if ($result = mysqli_query($con, $sql)) {
// echo "Query Executed";
// loop will iterate until all data is fetched
while ($row = mysqli_fetch_array($result)) {
$items = $row;
$valueMap[] = array($row['song_id']);
}
} else {
echo "Error in execution";
}
print_r($valueMap);
?>
<!-- <button onclick="{showData()}">CLICK</button> -->
<script type='text/javascript'>
function showData(){
var js_data = <?php echo json_encode($valueMap); ?>;
var jsArray = js_data.toString().split(',');
for(var i=0; i < jsArray.length; i++){
console.log(jsArray[i]);
}
}
</script>