Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. As I have no idea what the query was that produced those results, or what the input data to the query was, what is it you expect?
  3. I was trying to prevent bottlenecks when sending emails, and the below post was the solution. Similar predicament now, but I also need to generate some images first so they may be attached to the emails and the images are generated by a fairly slow command line program that emulates a browser. Multiple emails might or might need the same image so I plan on creating all the images before queuing the emails. I believe the futureTick approach executes each tick in series as blocking, but doesn't attempt to execute all of them at once so it doesn't impact the rest of the application.
  4. Today
  5. There are 2 gap difference that both these solutions have overlooked. A look at row 10 and 11 reveals that there a gap of 8 days between dateout on 10th row and datein on 11th row. which is unaccounted for. So on 11th row the diff should be 22 and not 14. Further on the last row there is a gap which could be calculated between dateout on 14th row and datein on 15th row i.e. DATEDIFF( '2020-08-27', '2020-05-22'). +-----+---------------+------------------------+ | Row | dateout | datein |diff | +-----+---------------+------------------------+ | 1 | '2019-03-30' | '
  6. If you only need HTML and CSS I like CSS Desk. Otherwise you can just turn off the console in jsfiddle to make your footer visible.
  7. Introducing your "studentlogin" column to the data ... +----+---------------------+---------------------+--------------+ | id | datein | dateout | studentlogin | +----+---------------------+---------------------+--------------+ | 1 | 2019-03-30 17:05:24 | 2019-03-30 17:09:47 | mina1111 | | 2 | 2019-04-01 15:13:32 | 2019-04-01 15:19:46 | abcd1234 | | 3 | 2019-04-04 23:37:21 | 2019-04-04 23:50:51 | xyz12345 | | 4 | 2019-04-18 15:28:35 | 2019-04-18 15:33:10 | mina1111 | | 5 | 2019-04-23 16:35:20 | 2019-04-23 16:42:35 | xyz12345 | | 6 | 2019-0
  8. jsfiddle is used when I want my piece to share(say on forum)
  9. Because of the JOIN, it is initialized before it is used. As an alternative to the join you could have two queries ... SELECT @prevout := NULL; -- initialize @prevout SELECT SUM(diff) AS tot_absent FROM ( SELECT CASE WHEN DATE(datein) > DATE(@prevout) THEN DATEDIFF(datein, @prevout) - 1 ELSE 0 END AS diff , datein , @prevout := dateout AS dateout -- store dateout in @prevout FROM ajoo_login ) logins; @vars are just like va
  10. Thank you Guru Barand. May I request you to clear some doubts that I expressed above in my earlier message. Thank you.🙏
  11. Sir that's not my intention at all. It's just that sometimes there are so may aspects to a problem that I try and request help for the core of it while trying to attempt the changes around it myself. It's only if I get stuck subsequently, like because of what i added, then I ask again. But I will keep it in mind and try and avoid that as far as possible. Thank you.
  12. look closer at the last line in the code that you have posted: ?>php } try this instead: <?php } ?>
  13. The most common causes of that error are an opening { or " without a corresponding closing } or "
  14. if($a==1) {?> <div class="container-fluid"> <div class="row"> <div class="col-lg-6 col-md-offset-3"> <div class="panel panel-primary"> <div class="panel-heading "> <h2 class="panel-title text-center ">Information</h2> </div> </div> </div> </div> </div> ?>php } Can you please help to identify and correct the above code error
  15. Yesterday
  16. Meanwhile, here's an alternative solution to my previous one, this one without the SQL variables. SELECT SUM(CASE WHEN DATE(datein) > DATE(dateout) THEN DATEDIFF(datein, dateout) - 1 ELSE 0 END ) as tot_absent FROM ( SELECT a.dateout , MIN(b.datein) as datein FROM ajoo_login a LEFT JOIN ajoo_login b ON a.dateout < b.datein GROUP BY a.dateout ) logins; +------------+ | tot_absent | +------------+ | 327 | +------------+
  17. This is a coding help forum where we help people learn. You will probably be bettor off making a "For Hire" post.
  18. I never understood the use for the default microtime() and even less understood why it is the default, and always pass the true argument to it. $timeFloat = microtime(true); $timeString = microtime(); var_dump($timeFloat); var_dump($timeString); $p=explode(' ', $timeString); var_dump($p[1]+$p[0]);
  19. I was looking for a way to import my movie ratings into my imdb account, which made me come across this method: https://github.com/tomzx/imdb-importer Here's the problem.. I'm not into programming and I haven't even heard of PHP before. I really want to use that code but I don't have the time to learn how to do it. Is anyone able to help me how to do it on a step by step guide? a guide that would include the very first step of downloading php to my computer. The ratings file looks like this: thank you.
  20. Where did that suddenly spring from? There's no mention in your original post. Don't keep us in the dark and still expect help.
  21. Hi Guru Barand, Thank you very much. I couldn't have figured it out this way since I have never really worked much with @variable in mysql. I am not sure I understand their working very well. However, this below is what I tried and it almost works except for the first and last bit of absents and resembles somewhat what requinix suggested. SELECT RecNo, DATEDIFF(( SELECT t.TimeOfLogin FROM india_sessdata t WHERE t.RecNo > t1.RecNo ORDER BY t.RecNo LIMIT 1), MIN(TimeOfLogin) ) diff FROM india_sessdata t1 WHERE t1.StudentLogin = 'mina1111' GROUP BY RecNo;
  22. Interesting - don't know how I've managed to avoid that issue. Thanks for the info!
  23. OK, I loaded your data into a test table INSERT INTO ajoo_login (datein, dateout) VALUES ('2019-03-30 17:05:24', '2019-03-30 17:09:47'), ('2019-04-01 15:13:32', '2019-04-01 15:19:46'), ('2019-04-04 23:37:21', '2019-04-04 23:50:51'), ('2019-04-18 15:28:35', '2019-04-18 15:33:10'), ('2019-04-23 16:35:20', '2019-04-23 16:42:35'), ('2019-04-24 12:03:07', '2019-04-24 12:10:28'), ('2019-05-01 08:05:48', '2019-05-01 08:20:28'), ('2019-05-08 18:04:04', '2019-05-08 18:14:57'), ('2019-05-09 08:18:15', '2019-05-09 08:29:38'), ('2019-06-18 12:49:01', '2019-06-18 13:10:15'), ('2019-09-05 17:17:33', '20
  24. Thanks Guru Barand and Requinix for the replies. @Guru Barand : Please find the data attached as data. I have tried your method but I am stuck at the comparison part where I need to reference the next date. @ Requinix : HI, I get the idea but I am not sure how to go about it. Thank you.
  25. I tried: $host = ""; $port = 502; // No Timeout set_time_limit(0); $socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("Could not create socket\n"); socket_connect($socket, $host, $port) or die("Could not connect to server\n"); socket_write($socket, $senddata) or die("Could not send data to server\n"); $result = socket_recv($socket, $buf , 2000 , 0 ); echo "Reply From Server :".strlen($result)." / ".strlen($result)." / ".strlen($buf); socket_close($socket); print "\n\n<br />\ntest1<br />\n"; but i still don't get output .... 11 03 138c6 0
  26. My version would be to JOIN the table to itself once or twice in order to pair up consecutive records, then DATEDIFF()-1 the end of the first with the start of the second, then SUM the results.
  27. Well, this would be one of those times. You can't do simple math like $now - $last with the value returned by microtime(). You need to use microtime(true) for that. For example: <?php $last = microtime(); sleep(5); $now = microtime(); $diff = $now - $last; printf("%0.4f seconds have passed", $diff); One might expect since the script sleeps for 5 seconds to get a result like 5.xxxx seconds have passed but what you actually get is: Notice: A non well formed numeric value encountered in W:\expired.php on line 7 Call Stack: 0.0002 391984 1. {main}() W:\expired.ph
  28. I have, and it was a genuine question. I guess I've just been lucky enough to have never come across a situation where the distinction has bitten me in the butt or where I've noticed, in all honesty.
  1. Load more activity
  • 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.