-
Notifications
You must be signed in to change notification settings - Fork 1
/
try1.php
62 lines (45 loc) · 1.52 KB
/
try1.php
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<head>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/font-awesome.css">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
</head>
<p id="songs_tab"></p>
<?php
//$user=$_SESSION["email"];
include("dbconfig.php");
/*$u="SELECT * FROM user_details WHERE `email`='$user' ";
$r=mysqli_query($con,$u);
$row=mysqli_fetch_array($r,MYSQLI_ASSOC);
$uid=$row["uid"];
//echo $name;
*/
$uid=1;
$sql="SELECT * FROM `liked_artist` WHERE `uid`='$uid' ";
$t=mysqli_query($con,$sql);
echo mysqli_error($con);
while($row=mysqli_fetch_array($t,MYSQLI_ASSOC))
{
$name=$row["name"];
echo "<input type='hidden' value=".$name." id='get_ele'/>";
echo "<p id='songs_tab'></p>";
echo "<script>
$(document).ready(function() { var variable=document.getElementById('get_ele').value;
console.log(variable);
$.getJSON(\"http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist=\"+variable+\"&api_key=4a9f5581a9cdf20a699f540ac52a95c9&format=json&callback=?\", function(json) {
var html = '';
var str='';
var sln = 0;
console.log(json);
var item_name=json.artist.name;
var item_url=json.artist.url;
str=JSON.stringify(json.artist.image[1]);
var sln = str.length;
str=str.slice(10,sln-17);
html += \"<img src=\"+str+\" alt='aa' style='border-radius:20%;width:8%'><a href=\"+item_url+\" style='font-size:20px;margin-left:150px;'>\"+item_name+\"</a><hr>\";
$('#songs_tab').append(html);
});
});
</script>";
}
?>