Jump to content

pkedpker

Members
  • Posts

    182
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

pkedpker's Achievements

Member

Member (2/5)

0

Reputation

  1. Okay this is pretty complicated to even explain but I will try. I am attempting to match up 2 tables which I have no problem doing at the moment. But it doesn't take into account that when the 2 tables have rows that match up. The rows which match up after the first row (not always the rows will match up but it's possible). The newly matched rows will not take into account the previous row changes. Here is the query SELECT S.itemId, S.amount, S.price, S.sold, S.playerHash, B.itemId, B.amount, B.price, B.bought, B.playerHash FROM Buying AS B JOIN Selling AS S ON B.itemId = S.itemId AND B.price >= S.price AND S.sold < S.amount AND B.bought < B.amount ORDER BY B.price DESC LIMIT 100 When the first Seller finds a Buyer it should compute instantly that the Buyer already bought the Seller's item. `S.amount` is total amount of items Seller has to sell. `S.sold` is total amount of items Seller has sold (if this S.sold = S.amount then no items left to sell) `B.amount` is total amount of items Buyer has to buy. `B.bought` is total amount of items Buyer has bought (if this B.amount = B.bought then no items left to buy) So the first row should simulate both tables change the S.sold and B.bought and Don't Update database for both tables when the row is outputted those will be the predicted changes.. (I still wan't to handle changes myself in case the program I do it on crashes then It should be able to re-do the ones the program missed) Calculate amount left to sell. Calculate amount left to buy. Calculate proper amount sold and proper amount bought. My math could be wrong here but here is a shot what I am trying to do. From research you cannot use IF in Sqlite have to resort to using CASE WHEN .. THEN .. ELSE .. END Then again I don't even know how to use these variables or updating both tables temporarily and joining both updated temporarily tables amountBuyerNeeds = (B.amount - B.bought) amountSellerStock = (S.amount - B.sold) B.bought = IF(amountBuyerNeeds > amountSellerStock, (B.bought + amountSellerStock), B.amount) S.sold = IF(amountSellerStock > amountBuyerNeeds, (S.sold + amountBuyerNeeds), S.amount)
  2. Very nice thank you works perfect, except has to be date_credited not created but no problem. Works good too, learned how to use date function thanks
  3. How do I select specific rows from DATETIME based on DATETIME in betweens lets say Today is 2012-11-27 I would like to get a chart based on SUM(reward) for each day for a whole week in the past. By seeing the image below it should show the same amount for each day. I was thinking something like this but it seems to merge certain days together. SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 1 DAY) AND date_credited < (NOW() + INTERVAL 1 DAY) UNION ALL SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 2 DAY) AND date_credited < (NOW() + INTERVAL 2 DAY) UNION ALL SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 3 DAY) AND date_credited < (NOW() + INTERVAL 3 DAY) UNION ALL SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 4 DAY) AND date_credited < (NOW() + INTERVAL 4 DAY) UNION ALL SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 5 DAY) AND date_credited < (NOW() + INTERVAL 5 DAY) UNION ALL SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 6 DAY) AND date_credited < (NOW() + INTERVAL 6 DAY) UNION ALL SELECT SUM(reward) FROM referrers WHERE referrer = '{$_SESSION['username']}' AND date_credited >= (NOW() - INTERVAL 7 DAY) AND date_credited < (NOW() + INTERVAL 7 DAY) Output is Day Reward 1 0.43 2 0.84 3 1.17 4 1.38 5 1.60 6 2.03 7 2.58
  4. solved it with a overflow: hidden no scollbar at all.. couldn't find a decent way to remove min-height: 100%
  5. Wow thanks for all your advise it's good information. What do you think is causing the min-height: 100% to be added to body. I couldn't find it anywhere in style.css seems to be added by some javascript. Any way to figure out what adds it? Thanks for all your advise Figured it out.. the Google translator adds that min-height. Anyway to cancel out CSS without javascript? tried adding min-height:100%; !important to style.css but the style in body overwrites that.
  6. here you can clearly see the scrollbar also how do I fix this problem with the ad scaling from the right side? how do I make it scale after the logo
  7. The scroller gets added as soon as the top ad gets moved into position. You can see there is no scroller if you refresh the site and quickly see before the ad gets moved. Still looking for a solution. Thanks
  8. After I put a google ad on the top I had various problems with it. First problem the ad is positioned in a way that if you move the website right to left it's clipped on the right side. How do I clip it after the logo instead? (the left side). Biggest problem is that the top ad added a Scrollbar for no reason and I don't know how to remove it now. Website is http://www.CamSpark.com As for posting code it looks like this <div id="adwrapperTop"> <?php include("ads/googletop.html"); ?> </div> CSS #adwrapperTop { position: absolute; right: 25em; top: 10px; border-collapse: collapse; }
  9. perfect thanks jesirose SELECT referrer, whoreferred, SUM(reward) FROM referrers WHERE referrer='sspoke' GROUP BY referrer, whoreferred
  10. How would I go about getting whoreferred added up their reward and show it under name sspoke. Say I login sspoke I should see jayman there with a reward of 33+21=0.54 I also want to see all the other users other then jayman and their totals SUM'ed up. I have no clue how to go about making this query mysql> SELECT * FROM referrers; +----+----------+-------------+--------+---------------------+ | id | referrer | whoreferred | reward | date_credited | +----+----------+-------------+--------+---------------------+ | 1 | Admin | sspoke | 0.43 | 2012-04-24 14:04:06 | | 2 | Admin | sspoke | 0.43 | 2012-04-24 14:04:06 | | 3 | sspoke | jayman | 0.33 | 2012-04-24 14:04:06 | | 4 | sspoke | jayman | 0.21 | 2012-04-24 14:04:06 | +----+----------+-------------+--------+---------------------+
×
×
  • 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.