Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/23/2019 in all areas

  1. He's testing for 0 or 1. 0! and 1! both equate to 1, so no need to calculate any further. Every recursive function needs a stop condition otherwise you quickly overflow the stack with an infinite recursion.
    1 point
  2. I was assuming that a report_filed meant they attended. But, yes, you could mysql> SELECT weekofyear(start_time) as wkno -> , SUM(is_no_show=0 AND is_cancelled=0) as attended -> , SUM(is_no_show=1) as no_shows -> , SUM(is_cancelled=1) as cancellations -> FROM heartstring -> GROUP BY wkno; +------+----------+----------+---------------+ | wkno | attended | no_shows | cancellations | +------+----------+----------+---------------+ | 40 | 2 | 0 | 0 | | 41 | 0 | 1 | 1 | | 42 | 1 | 0 | 0 | | 43 | 0 | 1 | 0 | +------+----------+----------+---------------+
    1 point
  3. It would help to see what your db data looks like EG, is it +------------+-----------+-----------+----------+ | start_time | no_shows | cancelled | attended | +------------+-----------+-----------+----------+ | 2019-12-20 | 1 | 0 | 0 | | 2019-12-21 | 0 | 0 | 1 | | 2019-12-22 | 0 | 1 | 0 | If so, then SELECT weekofyear(start_time) as weekno , SUM(no_shows = 1) as no_shows , SUM(cancelled = 1) as cancelled , SUM(attended = 1) as attended FROM mytable WHERE start_time BETWEEN ? AND ? GROUP BY weekno;
    1 point
  4. becomes... $sql_2_2 = "UPDATE analytics SET visitor_visitor_sessions = ?, visitor_visitor_pageviews = ?, visitor_visitor_pages = ? WHERE visitor_visitor_id = ? "; $stmt = $this->db->prepare($sql_2_2); $stmt->execute( [ $analytics['visitor_visitor_sessions'], $analytics['visitor_visitor_pageviews'], $analytics['visitor_visitor_pages'], $visitor_visitor_id ]);
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.