Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = $r['username'];
- $servername = "***";
- $username = "***";
- $password = "***";
- $dbname = "***";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM Wishlist WHERE User = '$user' ORDER BY Id ASC";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "<b>";
- echo $row['Name'];
- echo "</b><br>$";
- echo $row['Price'];
- echo "<br>";
- echo "<form method='post' action='wish2.php'>
- <input type='hidden' name='name' value='";
- echo $row['Name'];
- echo "'><input type='hidden' name='price' value='";
- echo $row['Price'];
- echo "'><input type='hidden' name='user' value='";
- echo $row['User'];
- echo "'><input type='submit' value='Bought this item'></form><br>";
- echo "<form method='post' action='remove.php'><input type='hidden' name='user' value='";
- echo $row['User'];
- echo "'><input type='hidden' name='item' value='";
- echo $row['Name'];
- echo "'><input type='submit' value='Remove the item from wishlist'></form>";
- echo "<hr>";
- }
- } else {
- echo "No items found in your wishlist!";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement