Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo '<td><form action="buy_item.php"><button>Buy</button></form></td>';
- <?php
- session_start();
- $conn = mysqli_connect("localhost", "localhost", "localhost", "localhost");
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT price,username,amount FROM items,users WHERE username = '" .
- $_SESSION['username'] . "' ";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- if $row["amount"] >= $row["price"] {
- $newAmount = $row["amount"] - $row["price"] ;
- header("location:/quickshops/seller/tutoadd.php");
- }
- else
- {
- echo "Records added successfully.";
- }
- }
Add Comment
Please, Sign In to add comment