Advertisement
Sparkster

Untitled

Jul 24th, 2013
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $pdo = new PDO("mysql:host=localhost;dbname=_fantapc", '_fpcroot', '');
  4.  
  5. $query = $pdo->prepare("SELECT * FROM cards WHERE id=:id");
  6. $query->bindValue(":id", $_GET['card_id'], PDO::PARAM_INT);
  7. $query->execute();
  8. $card = $query->fetch();
  9.  
  10. $query = $pdo->prepare("SELECT * FROM users WHERE username=:username");
  11. $query->bindValue(":username", $_SESSION['username'], PDO::PARAM_STR);
  12. $query->execute();
  13. $user = $query->fetch();
  14.  
  15. $query = $pdo->prepare("INSERT INTO prices(te_value,pot_value,luna_value, user_id, card_id) VALUES (:te_value,:pot_value,:luna_value,:user_id,:card_id)");
  16. $query->bindValue(":te_value", $te, PDO::PARAM_INT);
  17. $query->bindValue(":pot_value", $pot, PDO::PARAM_INT);
  18. $query->bindValue(":luna_value", $luna, PDO::PARAM_INT);
  19. $query->bindValue(":user_id", $user['id'], PDO::PARAM_INT);
  20. $query->bindValue(":card_id", $_GET['card_id'], PDO::PARAM_INT);
  21. $query->execute();
  22.  
  23. if(isset($_POST['formsub'])) {
  24.     $te = $_POST['te_value'];
  25.     $pot = $_POST['pot_value'];
  26.     $luna = $_POST['luna_value'];
  27. }
  28.  
  29. echo "<h1>" . "<img src={$card['img_avatar']} />" . $card['name'] . "</h1>";
  30.  
  31. ?>
  32.  
  33. <table class="table table-striped">
  34.     <tr>
  35.         <td></td><td><strong>TE Value</strong></td><td><strong>Pot Value</strong></td><td><strong>Luna Value</strong></td>
  36.     </tr>
  37.         <tbody>
  38.         <tr><td><strong>Min</strong></td><td><? echo $card['te_value']; ?></td><td><? echo $card['pot_value']; ?></td><td><? echo $card['luna_value']; ?></td></tr>
  39.         <tr><td><strong>Average</strong></td><td><? echo $card['te_value']; ?></td><td><? echo $card['pot_value']; ?></td><td><? echo $card['luna_value']; ?></td></tr>
  40.         <tr><td><strong>Max</strong></td><td><? echo $card['te_value']; ?></td><td><? echo $card['pot_value']; ?></td><td><? echo $card['luna_value']; ?></td></tr>
  41.  
  42. </tbody>
  43. </table>
  44. <br />
  45.  
  46. <?php
  47.  
  48. echo "<form action='index.php?page=card_details&card_id={$_GET['card_id']}' method='post'>";
  49.  
  50. ?>
  51.  
  52.     te value: <input type="text" name="te_value"><br>
  53.     pot value: <input type="password" name="por_value"><br>
  54.     luna value: <input type="text" name="luna_value"><br>
  55.     <input type="hidden" name="formsub" value="1">
  56.     <input type="submit">
  57.     </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement