Advertisement
Sparkster

Untitled

Jul 24th, 2013
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.17 KB | None | 0 0
  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.  
  16. if(isset($_POST['formsub'])) {
  17.     $te = $_POST['te_value'];
  18.     $pot = $_POST['pot_value'];
  19.     $luna = $_POST['luna_value'];
  20.  
  21.     $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)");
  22.     $query->bindValue(":te_value", $te, PDO::PARAM_INT);
  23.     $query->bindValue(":pot_value", $pot, PDO::PARAM_INT);
  24.     $query->bindValue(":luna_value", $luna, PDO::PARAM_INT);
  25.     $query->bindValue(":user_id", $user['id'], PDO::PARAM_INT);
  26.     $query->bindValue(":card_id", $_GET['card_id'], PDO::PARAM_INT);
  27.     $query->execute();
  28.  
  29. }
  30.  
  31. echo "<h1>" . "<img src={$card['img_avatar']} />" . $card['name'] . "</h1>";
  32.  
  33. ?>
  34.  
  35. <table class="table table-striped">
  36.     <tr>
  37.         <td></td><td><strong>TE Value</strong></td><td><strong>Pot Value</strong></td><td><strong>Luna Value</strong></td>
  38.     </tr>
  39.         <tbody>
  40.         <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>
  41.         <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>
  42.         <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>
  43.  
  44. </tbody>
  45. </table>
  46. <br />
  47.  
  48. <?php
  49.  
  50. echo "<form action='index.php?page=card_details&card_id={$_GET['card_id']}' method='post'>";
  51.  
  52. ?>
  53.  
  54.     te value: <input type="text" name="te_value"><br>
  55.     pot value: <input type="password" name="por_value"><br>
  56.     luna value: <input type="text" name="luna_value"><br>
  57.     <input type="hidden" name="formsub" value="1">
  58.     <input type="submit">
  59.     </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement