Jump to content

saynotojava

Members
  • Posts

    38
  • Joined

  • Last visited

saynotojava's Achievements

Member

Member (2/5)

0

Reputation

  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 A Fror, while in second two B frbo 100 0-In first table there is 100 entires with value B frbo, while second does not contain anything
  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>'; while($row = $result->fetch_assoc()) { $str = $row['Value1']; $str = strtoupper($str); echo" <tr> <td>echo $str</td> <td>echo {$row['Value2']}\"></td> <td>{$row['count']}</td> <td> "; $resultb = $conn->query("SELECT `Table2`.Value3, `Table2`.Value4, SUM(Payout) AS count , count(*) AS mu FROM `Table2` WHERE `Table2`.`Dt` between '2019-08-27 00:00:00' AND '2019-08-27 23:59:59' GROUP BY `Table2`.Value3, `Table2`.Value4 ; "); if ($resultb->num_rows > 0) { while($rowb = $resultb->fetch_assoc()) { $amo=substr($rowb['count'], 0, 5); echo $amo; $numb = $rowb['mu']; } } else { } echo " </td> <td>"; echo" </td> <td></td> <td> "; echo" </td> <td>"; echo"</td> <td> "; echo" </td> </tr> "; } echo' </tbody> </table>
  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 `Table2` WHERE `Table2`.`DateTime` between '2019-08-27 00:00:00' AND '2019-08-27 23:59:59' GROUP BY `Table2`.Va, `Table2`.Va2
  5. 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.
  6. 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.
  7. 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.
  8. But where is Tags in Video? That one is in list form (Dogs,Cats) and cannot be changed as it used already. That look fine if i would start with fresh table structure but i need to find solution to make it work with Tags in list form at table Video.
  9. Ok let me give entry example: Table Name: Videos VideoId - 12345 Tags - Dogs,Cats Clicks - 150 So this is current table, where problem is when i order by Clicks, there will be same video showed on both tags(tags is same thing as categories). Video should have separate clicking statistic for each Tag listed in Tags, so there could be different videos listed when clicking on Tag ordered by clicks. I was thinking about removing Clicks from structure of table videos, then creating table called Clicks which will contain Videoid, Tag and Clicks. So Videoid should be same value as relevant videoid in table Videos, so we can know to which video entry is related clicking statistic. And here is example: Table name:clicks Videoid:12345 Tag:Dogs Clicks:150 Hopefully now is more clear.Can post more examples if needed.
  10. I have a table which currently contain data like Videoid,Tags,and clicks. As table Tags contain multiple tags, this causing problem where a same video will show a top clicked video on each tag section which it contain. What it should be,is how each tag have it's own clicks. At the moment solutions which i have but dont find it suitable are following: 1.To put a single tag instead list of tags, this is problem as then i would have to copy same data for every tag 2.To create another table called Clicks, and everytime when it is clicked on video in new tag, copy all relevant data from first table and then call UNION query. Problem with this how we also have duplicates(tho alteast not big as in first case, as new data is inserted only when click occur) and second is how same videos could show, as first it will show one which contain click stats and single tag, and then same video which dont contain click stats from first table. Closest to solution was using CROSS JOIN query, but problem with that query is how is simply pulling all data id by id, and it need to be linked, for example both tables have Videoid table which is same, and then order by Clicks which is in second table.
  11. I tried to find working tutorial for REST API and with these two frameworks but nothing what i found worked.Basicly i want to attach REST API to a simple CRUD application. So if anyone have links with good explanation that would be good.
  12. Nevermind,had to set column as INT to make it work.
  13. Ok i found a proper query: SELECT MAX(POSITION) but it seems something is bugged here: ,when it reach number 10(i set a counter +1 on each new entry),for some reason it output number 9 as biggest number,not 10.And another thing,i have query to order by that column where i stored those numbers,but number 10 it is not last,for some reason it is sorted right after 1.
  14. Let say i have five values in this structure: Student Score John 5 Johhy 4 Johnny 3 Jon 1 Job 2 And i want to find a value which have biggest number,in this case John. How do i do that?
  15. I have following two dimensional array: $shop = array( array( Title => "rose", Price => 1.25, Number => 15 ), array( Title => "daisy", Price => 0.75, Number => 25, ), array( Title => "orchid", Price => 1.15, Number => 7 ) ); Where i want to unset/remove one array in it,i do that with following: $count=3; unset ($shop[0]); And i output array after that with this: for ($row = 0; $row < $count; $row++) { echo $shop[$row]["Title"]." costs ".$shop[$row]["Price"]." and you get ".$shop[$row]["Number"]; echo "<br />"; } The problem is how with unset array is not fully removed,it just show as empty value,so while it should output array like this: daisy costs 0.75 and you get 25 orchid costs 1.15 and you get 7 It shows this: costs and you get daisy costs 0.75 and you get 25 orchid costs 1.15 and you get 7 And if i output array with print_r,then it shows properly but i need it with echo format.
×
×
  • 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.