Chrisj Posted April 7, 2019 Share Posted April 7, 2019 The original web script that I'm using calculates daily earnings from video purchase transactions. I have added my own videos purchase transactions code into this web script successfully, and I'm trying to integrate my successfully working code part in with the original web script's page - that displays the daily earnings. Here is (part) of the original web script's code: $day_start = strtotime(date('M')." ".date('d').", ".date('Y')." 12:00am"); $day_end = strtotime(date('M')." ".date('d').", ".date('Y')." 11:59pm"); $this_day_ads_earn = $db->rawQuery("SELECT SUM(amount) AS sum FROM ".T_ADS_TRANS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND type = 'video' AND video_owner = ".$pt->user->id); $this_day_video_earn = $db->rawQuery("SELECT * FROM ".T_VIDEOS_TRSNS." c WHERE `time` >= ".$day_start." AND `time` <= ".$day_end." AND user_id = ".$pt->user->id); $day_net = 0; foreach ($this_day_video_earn as $tr) { if ($tr->currency == "USD") { $day_net = $day_net + ($tr->amount - $tr->admin_com); } else if($tr->currency == "EUR"){ $day_net = $day_net + ($tr->amount - $tr->admin_com); } } $today_earn = $this_day_ads_earn[0]->sum + $day_net ; The table they are using is T_VIDEOS_TRSNS, my modification stores video transactions in the table T_U_PAID_VIDEOS, and the earnings amount is stored in the 'earned_amount' column. I'd like to substitute my code in, so the purchase transaction from my mod shows on the original web script's already set up page. I look forward to, and appreciate, any suggestions, or requests for more info/code. Quote Link to comment Share on other sites More sharing options...
requinix Posted April 7, 2019 Share Posted April 7, 2019 We've done this song and dance a few times, you know. Do you have specific questions? Surely you understand how the earnings stuff works by now? Quote Link to comment Share on other sites More sharing options...
Chrisj Posted April 7, 2019 Author Share Posted April 7, 2019 Thanks for your reply, but I'm not clear on what you are telling me. Any help with substituting my code with the original script is appreciated. Quote Link to comment Share on other sites More sharing options...
gizmola Posted April 12, 2019 Share Posted April 12, 2019 I think his point is, that you are basically asking someone to rewrite code to your specifications. On a good day, with the right type of question, you might get people writing code for you, especially if there is something very interesting or challenging about it. This is not one of those questions. Basically, we need to see what you tried to do that didn't work. As it is, you haven't tried anything yet. Do some work, and come back with questions, and you might surprise yourself and fix it yourself. ? 1 Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted April 12, 2019 Share Posted April 12, 2019 On 4/6/2019 at 9:55 PM, Chrisj said: Thanks for your reply, but I'm not clear on what you are telling me. Any help with substituting my code with the original script is appreciated. I read your original post a couple times, and not sure what you are asking. Maybe I needed to follow your earlier posts for reference? Regardless, if you are trying to substitute one set of code with another, you need to figuratively draw a circle around it and understand (and even write down) how it interfaces to the remaining code, and then make sure your new code interfaces to the remaining code the same way. 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.