Jump to content

Search the Community

Showing results for tags 'trading'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello. I've been having trouble with this trade system not working(my friend made it). Most of it is functioning properly, except the part where it's supposed to show your partners pokemon box. Here is the code: <?php require_once("top_header.php"); if(!isset($_GET["p"]) && !isset($_GET["id"]) && !isset($_GET["submit"])) { ?> <form action="trading.php" method="get"> Please enter the ID of the person you would like to trade:<br /> <input type="text" name="p" /><br /> <input type="submit" value="Continue!" /><br /> </form> <table width=100%> <tr> <td class="header">Trade Partners:</td> <td class="header">Open Trades:</td> </tr> <?php $check1 = "SELECT trade_id, starter_id FROM trades WHERE partner_id = $id AND status = 0"; $check2 = mysql_query($check1); while($row = mysql_fetch_array($check2)) { $ass = mysql_fetch_array(mysql_query("SELECT username FROM users WHERE id = {$row["starter_id"]}")); echo "<tr>"; echo "<td class=into>"; echo $ass["username"]; echo "</td>"; echo "<td class=into>"; echo "<a href=trading.php?id={$row["trade_id"]}>View Trade!</a>"; echo "</td>"; echo "</tr>"; } ?> <tr> <td class="header">Created To:</td> <td class="header">Options:</td> </tr> <?php $check1 = "SELECT trade_id, partner_id FROM trades WHERE starter_id = $id AND status = 0"; $check2 = mysql_query($check1); while($row = mysql_fetch_array($check2)) { $ass = mysql_fetch_array(mysql_query("SELECT username FROM users WHERE id = {$row["partner_id"]}")); echo "<tr>"; echo "<td class=into>"; echo $ass["username"]; echo "</td>"; echo "<td class=into>"; echo "<a href=delete.php?id={$row["trade_id"]}>Delete Trade!</a>"; echo "</td>"; echo "</tr>"; } ?> </table> <?php } else if(isset($_GET["p"])) { $check = mysql_num_rows(mysql_query("SELECT username FROM users WHERE id = ".$_GET['p']."")); if($check <= 0) { echo "Please do not try to trade non existant users!"; include('bottom_layout.php'); die(); } ?> <form action="trading.php?submit" method="post"> <b>Your Pokemon:</b><br> <select width="100px" size=15 name="starter[]" multiple="multiple"> <option value="0" selected>None</option> <?php $query = mysql_query("SELECT id, nickname, level FROM pokemon WHERE owner_id= $id AND slot = 7"); while($info = mysql_fetch_assoc($query)) { ?> <option value="<?php echo $info["id"] ?>"><?php echo $info["nickname"] ?> level:<?php echo $info["level"]?></option> <?php } ?> </select> <br><br><br> <b>Partners Pokemon</b><br> <select width="100px" size=15 name="partner[]" multiple="multiple"> <option value="0" selected>None</option> <?php $p = htmlentities($_GET["p"]); $sql = "SELECT id, gender, pokedex_id, type, level FROM pokemon WHERE owner_id = $p AND slot = 7 AND status = 1"; $starter_pokemon = mysql_query($sql); while($row = mysql_fetch_assoc($starter_pokemon)) { $name = mysql_fetch_assoc(mysql_query("SELECT name FROM pokedex WHERE id={$row["pokedex_id"]}")); $type = mysql_fetch_assoc(mysql_query("SELECT name FROM types WHERE id={$row["type"]}")); $name = $type["name"].$name["name"]; ?> <option value="<?php echo $info["id"] ?>"><?php echo $info["nickname"] ?> level:<?php echo $info["level"]?></option> <?php } ?> </select><br /> <input type="submit" value="Send Trade!" /> <input type="hidden" name="p_id" value="<?php echo $_GET["p"];?>" /> </form> <?php } else if(isset($_GET["submit"])) { $status = 0; $partner = mysql_real_escape_string($_POST["p_id"]); foreach($_POST["starter"] as $pokemon) { $pokemon = mysql_real_escape_string($pokemon); $result = mysql_query("SELECT id FROM pokemon WHERE owner_id = $id AND id = $pokemon"); if(mysql_num_rows($result) == 0 && $pokemon != 0) { $status = 5; } } foreach($_POST["partner"] as $pokemon) { $pokemon = mysql_real_escape_string($pokemon); $result = mysql_query("SELECT id FROM pokemon WHERE owner_id = $partner AND id = $pokemon"); if(mysql_num_rows($result) == 0 && $pokemon != 0) { $status = 5; } } $starter_pokemon = json_encode($_POST["starter"]); $partner_pokemon = json_encode($_POST["partner"]); if($starter_pokemon == "[\"0\"]" && $partner_pokemon == "[\"0\"]") { echo "Sorry, one of you has to be trading something!"; } $sql = "INSERT INTO trades (starter_id, starter_pokemon, partner_id, partner_pokemon, status) VALUES ($id, '".mysql_real_escape_string($starter_pokemon)."', $partner, '".mysql_real_escape_string($partner_pokemon)."', $status)"; mysql_query($sql); echo "Trade created!"; } else if(isset($_GET["id"])) { $trade = mysql_real_escape_string($_GET["id"]); $sql = "SELECT * FROM trades WHERE trade_id = $trade"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $starter_pokemon = json_decode($row["starter_pokemon"]); $partner_pokemon = json_decode($row["partner_pokemon"]); echo "<h3>You are Trading:</h3>"; foreach($partner_pokemon as $pokeid) { $pokeinfo = mysql_fetch_assoc(mysql_query("SELECT pokedex_id, gender, type, level FROM pokemon WHERE id = $pokeid")); $name = mysql_fetch_assoc(mysql_query("SELECT name FROM pokedex WHERE id = {$pokeinfo["pokedex_id"]}")); $type = mysql_fetch_assoc(mysql_query("SELECT name FROM types WHERE id = {$pokeinfo["type"]}")); echo $type["name"].$name["name"]." ({$pokeinfo["gender"]}) (Level:{$pokeinfo["level"]})<br />"; } echo "<h3>Your Partner is Trading:</h3>"; foreach($starter_pokemon as $pokeid) { $pokeinfo = mysql_fetch_assoc(mysql_query("SELECT pokedex_id, gender, type, level FROM pokemon WHERE id = $pokeid")); $name = mysql_fetch_assoc(mysql_query("SELECT name FROM pokedex WHERE id = {$pokeinfo["pokedex_id"]}")); $type = mysql_fetch_assoc(mysql_query("SELECT name FROM types WHERE id = {$pokeinfo["type"]}")); echo $type["name"].$name["name"]."({$pokeinfo["gender"]}) (Level:{$pokeinfo["level"]})<br />"; } ?> <br><br> <a href=complete.php?id=<?php echo $row['trade_id']; ?>>Complete the trade!</a><br><a href=delete.php?id=<?php echo $row['trade_id']; ?>>Delete the trade!</a> </table> <?php } require_once("bottom_layout.php"); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.