-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
executable file
·66 lines (61 loc) · 2.77 KB
/
index.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
63
64
65
66
<?php
require 'includes/database.php';
require 'includes/script.php';
$conn = getDB();
$capstone = new Capstone("092d316884d8385f35ad8b84f5f42ef8");
/* API call connection */
// $topartists = $capstone->getTopArtists();
// $topTracks = $capstone->getTopTracks();
// $getYouTube = $capstone->getYouTube("taylor swift");
// $getImage = $capstone->getImage("taylor swift");
/* Add API connection results to database */
// $artistSQL = $capstone->topArtistTable($capstone->getTopArtists(), $conn); // don't uncomment, it'll delete/update
// $trackSQL = $capstone->topSongsTable($capstone->getTopTracks(), $conn); // the database and we only get so many calls to the API's each day
/* Select all records from database */
$allArtists = $capstone->getAllArtists($conn);
$allTracks = $capstone->getAllTracks($conn);
?>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="includes/style.css">
<title>Capstone</title>
</head>
<body>
<br>
<div id="tabs">
<ul>
<li><a href="#tabs-1">Top Artists</a></li>
<li><a href="#tabs-2">Top Songs</a></li>
</ul>
<div id="tabs-1">
<?php while($row = $allArtists->fetch_assoc()) { ?>
<div class="information-container">
<a href="artist.php/?id=<?= $row["id"] ?>">
<?= "<br>" . $row["id"]. " - " . $row["artist_name"] . "<br>"; ?>
<img src="<?= $row["artist_image"]?>" width="100" height="100">
<br>
</a>
</div>
<?php } ?>
</div>
<div id="tabs-2">
<?php while($row = $allTracks->fetch_assoc()) { ?>
<div class="information-container">
<a href="song.php/?id=<?= $row["id"] ?>">
<?= "<br>" . $row["id"] . " - " . $row["song_name"] . " by " . $row["artist_name"] . "<br>"; ?>
<img src="<?= $row["album_image"]?>" width="100" height="100">
<br>
</a>
</div>
<?php } ?>
</div>
</div>
</body>
<script src="./includes/script.js"></script>
</html>