-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstrument.php
More file actions
26 lines (20 loc) · 815 Bytes
/
instrument.php
File metadata and controls
26 lines (20 loc) · 815 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
<?php
// GET the id of the movie (coming from the URL)
$id = $_GET['id'];
// 1. Connect to my DB
$conn = mysqli_connect('localhost', 'root', '', 'music_shop');
// 2. Prepare the query
$query = 'SELECT *
FROM instruments
WHERE id = ' . $id;
// To see how your query looks like : echo $query;
// 3. Executing the query (send the query to the DB)
$results = mysqli_query($conn, $query);
// 4. Fetch only one result
$instrument = mysqli_fetch_assoc($results);
echo '<img src="' . $instrument['photo'] . '" width="100px">';
echo 'Name : ' . $instrument['name'] . '<br>';
echo 'Brand Name : ' . $instrument['brand_name'] . '<br>';
echo 'Price : ' . $instrument['price'] . '<br>';
echo 'Type : ' . $instrument['type'] . '<br>';
echo 'Description : ' . $instrument['description'] . '<br>';