darkfreaks Posted January 3, 2009 Share Posted January 3, 2009 okay guys i need advice on how i would go making it so it compares the time with the submitted offer time with the current time what way is best to do it. right now the current code has no time slot in the Db to compare it so if you make an example code i could go off of i would be happy. <?php $openHTML"; echo "<a href='maketrade.php?view=trades'>Trading Post Main</a> | <a href='mytrades.php'>Browse Lots</a> | <a href='$PHP_SELF'>Offers You made</a> <br />"; while ($view = mysql_fetch_array($myoffers)) { $getofferid = mysql_fetch_array(mysql_query("SELECT * FROM `trade_offers` WHERE `user_id`='$userid' AND `item_id`!=''")); $gettradeowner = mysql_fetch_array(mysql_query("SELECT * FROM `trades` WHERE `id`='$view[trade_id]'")); $getowner = mysql_fetch_array(mysql_query("SELECT * FROM `members2` WHERE `id`='$gettradeowner[owner]'")); $getitems = mysql_query("SELECT * FROM `trade_offers` WHERE `trade_id`='$getofferid[trade_id]' AND `trade_id`!=''"); echo "<center><table cellpadding='0' cellspacing='2' border='1' style='border-style:solid;border-color:#eeeeee;border-width:1px;' bordercolor='#eeeeee'> <tr> <td bgcolor='#eeeeee' colspan='2'><b>Offers you have made</b></td> </tr> <form action='$PHP_SELF?action=cancel' method='post'><tr> <td bgcolor='#eeeeee'>"; echo "<pre><b>Offer $getofferid[id] Lot $view[trade_id]</b><br /> (owned by <a href='user_profile.php?game=1&user=$getowner[display_name]'>$getowner[display_name]</a>)</td> </tr> <tr> <td colspan='2'>"; while ($items = mysql_fetch_array($getitems)) { $itempic = mysql_fetch_array(mysql_query("SELECT * FROM `items2` WHERE `id`='$items[item_id]'")); echo "<img src='../images/user_images/opg_1/items/item_$items[item_id].gif' border='0'><br /><b>Name:</b> $itempic[item_name]<br /><b>Description:</b> $itempic[item_desc]<br />"; } $cp = $getofferid[cp]; $offeredon = mysql_query("SELECT * FROM `trade_items` WHERE `trade_id`='$view[trade_id]'"); echo "CP Offered: $cp</td> </tr> <tr> <td bgcolor='#eeeeee' colspan='2'><b>Items offered on</b></td> <tr> <td>"; while ($offereditems = mysql_fetch_array($offeredon)) { $itemp = mysql_fetch_array(mysql_query("SELECT * FROM `items2` WHERE `id`='$offereditems[item_id]'")); echo "<img src='../images/user_images/opg_1/items/item_$offereditems[item_id].gif' border='0'><br /><b>Name:</b> $itemp[item_name]<br /><b>Description:</b> $itemp[item_desc]<br />"; } echo " </td> </tr> <tr> <td colspan='2'><center><input type='submit' value='Cancel this offer!' name='cancel_offer'></center> <input type='hidden' name='tradedid' value='$getofferid[trade_id]'><input type='hidden' name='item_id' value='$getofferid[item_id]'>"; echo "</td> </tr> </table> <br /><br /><br /> </form> "; } if ($_POST['cancel_offer']) { $tradedid = $_POST['tradedid']; $item_id = $_POST['item_id']; $delete = mysql_query("SELECT * FROM `trade_offers` WHERE `user_id`='$userid'"); while ($trade = mysql_fetch_array($delete)) { mysql_query("DELETE FROM `trade_offers` WHERE `trade_id`='$tradedid' AND `user_id`='$userid'"); mysql_query("UPDATE `members2` SET `points`=points+$cp WHERE `id`='$userid'"); mysql_query("UPDATE `usersitems2` SET `trading`='no' WHERE `item_id`='$trade[item_id]'"); } die(header(error("myoffers.php","Trade deleted successfully!"))); } ?> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted January 3, 2009 Share Posted January 3, 2009 Sorry, what? What are you trying to compare? I could be wrong, but it looks to me like a large amount of that code is irrelevant to your problem. Try narrowing it down. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.