
saynotojava
Members-
Content Count
38 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout saynotojava
-
Rank
Member
-
Joining two select queries with WHERE clause
saynotojava replied to saynotojava's topic in MySQL Help
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 -
Joining two select queries with WHERE clause
saynotojava replied to saynotojava's topic in MySQL Help
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>'; -
Joining two select queries with WHERE clause
saynotojava replied to saynotojava's topic in MySQL Help
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. -
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
-
Ok solution found.
-
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.
-
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.
-
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
-
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.
-
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.
-
So in shortly, not possible ?
-
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
-
Changing sorting order in pagination class
saynotojava replied to saynotojava's topic in PHP Coding Help
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. -
Changing sorting order in pagination class
saynotojava replied to saynotojava's topic in PHP Coding Help
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. -
Changing sorting order in pagination class
saynotojava replied to saynotojava's topic in PHP Coding Help
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.