SHOW:
|
|
- or go back to the newest paste.
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 | - | $row = $query->fetch(); |
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 | - | $query->bindValue(":user_id", $row2['id'], PDO::PARAM_INT); |
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 | - | $row2 = $query->fetch(); |
21 | + | |
22 | ||
23 | if(isset($_POST['formsub'])) { | |
24 | - | echo "<h1>" . "<img src={$row['img_avatar']} />" . $row['name'] . "</h1>"; |
24 | + | |
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 | - | <tr><td><strong>Min</strong></td><td><? echo $row['te_value']; ?></td><td><? echo $row['pot_value']; ?></td><td><? echo $row['luna_value']; ?></td></tr> |
33 | + | |
34 | - | <tr><td><strong>Average</strong></td><td><? echo $row['te_value']; ?></td><td><? echo $row['pot_value']; ?></td><td><? echo $row['luna_value']; ?></td></tr> |
34 | + | |
35 | - | <tr><td><strong>Max</strong></td><td><? echo $row['te_value']; ?></td><td><? echo $row['pot_value']; ?></td><td><? echo $row['luna_value']; ?></td></tr> |
35 | + | |
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 | - | te value: <input type="text" name="username"><br> |
54 | + | luna value: <input type="text" name="luna_value"><br> |
55 | - | pot value: <input type="password" name="password"><br> |
55 | + | |
56 | - | luna value: <input type="text" name="email"><br> |
56 | + | |
57 | </form> |