Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by saynotojava

  1. They share common values, like Value1 is same as Value3 and Value2 is same as Value4. They also share datetime column which is same. And here is some data output example:: Table1 Table2 Value1 A Value2 fror Value3 A Value4 fror Value1 B Value2 frbo Current code counts number of each duplicates, in this case first query number of values A/fror in Table1 , and same in Table2. In case table2 does not contain anything .then i show it as zero. So end result look like this: A Fror 500 2 -In first table there 500 entries with value
  2. Ok here is full currently working code with 2 queries, and goal is to have only one query instead. $result = $conn->query("SELECT `Table1`.Value1, `Table1`.Value2, count(*) AS count,SUM(Co) AS sum FROM `Table1` WHERE `Table1`.`Dt` between '2019-08-27 00:00:00' AND '2019-08-27 23:59:59' GROUP BY `Table1`.Value1, `Table1`.Value2 ; "); echo' <table class="zui-table zui-table-highlight-column"> <thead> <tr> <th>Value1</th> <th>Value2</th> </tr> </thead> <tbody>';
  3. Visits thing was error, updated post to properly show first query(it's table1 instead). Also, Using Left/Right Union was one was with which i tried to solve it, does not need to be same method but it seems it does what i trying to accomplish. At the moment i loop query with table2 , and when there is no result, i output it as zero.
  4. I have two mysql queries , where currently i run second query by loop, so would like to reduce loading time by making single query. However, it seems there is some issue with WHERE clause which i can put it into only one query when using LEFT/RIGHT JOIN with Union and i use WHERE in both queries. Here is queries: SELECT `Table1`.Va, `Table1`.Va2, count(*) AS count,SUM(Co) AS sum FROM `Table1` WHERE `Table1`.`Dt` between '2019-08-27 00:00:00' AND '2019-08-27 23:59:59' GROUP BY `Table1`.Va, `Table1`.Va2 SELECT `Table2`.Va, `Table2`.Va2, SUM(Payout) AS count , count(*) AS mu FROM
  5. Currently that does not work as function before output 3 ip's instead one, for example when i was testing it with alert, each ip was displayed in 3 alert instead all 3 in one alert. Tho, could be solved if i would remove those 2 ip's and have one only, but dont know which line exactly to remove.
  6. Same what i doing with almost any javascript- send it to ajax call so i can process it further with php. So that means i could get right ip adress with php explode, but i still need to get that output properly, as for example, when i put console log or alert into function addIP function, it loops , and if i tried to get it outside that function, then there is no output.
  7. I have this code: <script> function findIP(onNewIP) { var myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; var pc = new myPeerConnection({iceServers: [{urls: "stun:stun.l.google.com:19302"}]}), noop = function() {}, localIPs = {}, ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g, key; function ipIterate(ip) { if (!localIPs[ip]) onNewIP(ip); localIPs[ip] = true; } pc.createDataChannel(""); pc.createOffer(function(sdp) { sdp.sd
  8. Figured out that one as well - i had jquery include in http url, and for some reason firefox is blocking js load in case of protocol mismatch.
  9. Finally figured out what i was doing wrong- i need to use echo only, not session, since it is ajax call is the one which handle data back and forth. Since session is method what is used in PHP to handle data between pages, i assumed same for javascript but it was wrong assumption. But there is still one problem remaining - for some reason, ajax call is not working on https protocol . I found possible solution here: https://serverfault.com/questions/891980/ajax-post-not-working-on-https-ssl-nginx , but it's not working.
  10. So i have two files, one with ajax call and second with content which is called. And i get what i need(displaying session variable so in this case), but only when i manually refresh page, while i should see result immediately after i load file with ajax call for first time. Is that possible? Test.php <?php session_start(); ?> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script type="text/javascript"> $.ajax({ type: "GET", url: 'ab.php', data: {name: 'Wayne', age: 27, country: 'Ireland'} }); </script> <?php ec
  11. Actually, when i tested different queries, when you dont specify ORDER in query, by default it order by ID(alias first column). So if you dont want ORDER to run , then you need to specify NULL.
  12. There is not much difference between example code and my code, only difference is sql query and obviously HTML layout. Everything else is same as in example code.
  13. It's a specific query in specific situation which require order by NULL to make it work properly. It does sounds like a terrible thing, but since i have this class already, it should be possible to reverse page output, so page 1 become page 10,page 2 become 9 and so on.
  14. I am using following pagination class: https://github.com/BenGriffiths/pdo-mysqli-pagination and i have specific situation where i cant use ordering inside mysql query. How do i change sorting in this pagination class, where loading first page wont load first page but last page instead ? (that way i'l get proper sorting)
  15. 1. I was copy paste-ing example code so that line was copied too. I always have it only once. 2.This is how i have it stored - ID 1 Android ID 2 Iphone ID 3 Raspberry 3.Yes it is, not just for that but also to prevent sql injection. Tho, first i want to finish my project , then i will go over entire code and switch all querys with prepared statements. 4. I dont see how at the moment. Tho, i should find it step by step. And here is sample of current working code: $conn = new mysqli($servername, $username, $password, $dbname); $result = $conn->query("SELECT temp FROM t
  16. Working now, was loading wrong query in second loop. This thread can be closed.
  17. Yes, just tested it and it seems php code/query can be looped inside while loop. Tho, it seems it does not load second entry in table, only first one.
  18. So, i have following code: $conn = new mysqli($servername, $username, $password, $dbname); $result = $conn->query("SELECT COUNT(`Device`) AS 'KU' FROM `table` WHERE `Device` LIKE '%android%'"); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { { echo "<font size=\"6\"> <div align=\"left\">Overall number of android devices is {$row['KU']} </div></font>"; } } } else {} $conn = new mysqli($servername, $username, $password, $dbname); $result = $conn->query("SELECT COUNT(`Device`) AS 'KU' FRO
  19. Let me put this way - let's say you are webmaster, and i am advertiser. I give you a link to advertise on your site, you checked it and it is fine. But i added a setting to redirect to bad url which is different then your browser, and wouldn't you want to know what is really happening? I dont need to know what exactly is user doing it after url is loaded, but i do need to know does he see same thing when i load url in my browser.
  20. Purpose of this is to detect malware/bad links in redirect url - when you have a redirect url which redirect based on criteria, url might be fine when you check with your browser, but could be malware/bad link with other browser. Method does not need to be iframe(this is just idea to do it), nor user need to stay on site, i just need to see what happening with user when he leave site. At the moment i need to use different browsers manually to do such checks, but when you have tons of links to check it become a tedious job.
  21. How do i record with php when user loads external url which redirect , what urls's he loaded by using invisible iframe(so the user still stay at my site) ? I do know this can be done with curl and i tested it, but problem with curl how it access url redirect by using server, while it should access as user.
  • 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.