Jump to content

ajoo

Members
  • Content Count

    813
  • Joined

  • Last visited

Everything posted by ajoo

  1. ajoo

    string checks

    hmm, So I can finally use isset($_POST["whatever"]) && is_string($_POST["whatever"]) && trim($_POST["whatever"]) != "" because, as you said, if it's a string, it won't be false or null. Thanks.
  2. ajoo

    string checks

    Hi ! @ gw1500se : While it's complicated I don't think it would require a regex since it's also basic. @requinix : Since this is an input received via ajax, someone can try and doctor the input to try and break the code. Hence I had the == false as well. And since a string won't be equal to false, I am thinking that it may be necessary to check that the input received is indeed a string. Wouldn't that be so ? Would you still go ahead with your code that you pasted above? Thanks !
  3. ajoo

    string checks

    Hi, The following seems to work but still allows for a non string 0. (isset($str) && $str !==false && $str !==''){ . . . } Maybe I need to check for an is_string as well. I was hoping to find something simpler if it exists. Thanks !
  4. Hi, I wish to check for a condition that a string received is not white space or false or null but it should allow the string '0'. This must be a very simple problem but it is definitely quite confusing. Thanks loads.
  5. Hi Guru Barand, Just saw this. Thanks for the insight into the handling of holidays and pointing out the flaw. Thank you so much, Truly grateful !
  6. Hi Guru Barand, Thanks loads for your help, Sir, so far, there is no further query that requires this data. It will be displayed on the home page of the tutor, so that he can see instantly the 'gap' ( the no of days elapsed between the current and last login) in logins of the students as well as 'absents', the totals number of days the student has been irregular in the program. He can then use this information to check this rate and minimize it or take suitable action. For this I am actually using a complete separate table. I am doing it wrong as.I am storing the latest values of login and other parameters like lastlogin date, scores, calculated absents etc for each student in table A by taking them off from another table B that stores the same information for each day since the child registers. Then I am using this table A with latest values to display the status, lastlogin date and scores and gaps and absents etc after due calculation in php on the tutor's home page. Creating table A from B is incorrect since its duplication of data. With this query, I will to remove table A completely and do the calculations on the fly of gaps and absents and scores ( which were on the fly in any case but I was storing them in table A) to display them on the tutor home page. Thanks loads !🙏
  7. Hi Guru Barand, I modified your code just a trifle to get the table in the inverse order, and that makes it more accurate as a row has a complete information now for the query that I wish to execute. Here's the code modified just so as also some var names, SELECT recno , timeoflogout , gaps , @tot := @tot + IFNULL(gaps,0) as absents FROM ( SELECT recno , DATEDIFF(timeoflogout, @prevlog ) - 1 as gaps , @prevlog := timeoflogout as timeoflogout FROM ( SELECT recno , timeoflogout FROM ajoo ORDER BY timeoflogout ASC ) as sorted JOIN (SELECT @prevlog := NULL, @tot := 0) as initialise )recs; which gives the output as The row that I now wish to examine is the last row of the table. It seems quite tricky to me to retrieve this value as if I invert the order to pick the first row, the calculated field remains at the last, unchanged, and If i use the recno reference at the end of the query (WHERE recno = 30), the calculated field becomes 0. So How do I retrieve the last row values from the above table, if possible, without creating a temporary table and then querying it? Thanks loads !
  8. Any way that we can count and get the total absents in the query itself. I tried as below SELECT recno , DATEDIFF(@prevlog, TimeOfLogout) - 1 as absents , @prevlog := TimeOfLogout as TimeOfLogout , @tot := @tot+ absents as total FROM ( SELECT recno , TimeOfLogout FROM india_sessdata WHERE StudentLogin = 'nina12345' ORDER BY TimeOfLogout DESC ) as sorted, (SELECT @tot:=0) t JOIN (SELECT @prevlog:=NULL) as initialise; but it gives this error below 😒 Thanks
  9. Thank you Guru Barand ! It will take me some more time to decode your code but it works great !! Thanks loads !
  10. Hi Psycho, The absents is not part of the table. It was there to show what I wanted as output. So all absents have to be calculated on the fly and then summed to get to the figure of 15 absents on date 30th. Some kind of iterative loop is needed I guess. Thanks.
  11. hi all ! I have the following set of data The first 2 columns are the data, the 3rd column, absent, is what I wish to calculate at each level of entry and finally then sum of all the absents till that particular entry. So here for example on RecNo 30, the total of all absents so far is 15. I wish to do this using mysql alone. Any help appreciated. Thanks !
  12. Hi all ! I managed to find the solution. For anyone interested, the following code / command manages it. $graph->setupYAxis(n,'color'); where n is an integer. Thanks !
  13. Hi all ! I am using the phpgraphlib library for charting. I am using a bar-graph. (example 3 on https://github.com/elliottb/phpgraphlib/commit/d5096c8cbb38d75452f4d7036b7a64979b5e19db). I am displaying the dates on the x-axis. However the dates only show the month and date but the year is cutoff. Is there some way to get the x-axis to move up to accommodate the complete date along the x-axis? Thank you.
  14. Hi Benanamen, Can it be installed along with xampp on the same machine or would it conflict. Thanks.
  15. Hi, This is a probably a wrong way of inserting new email into the DB and can result in race conditions. You should be inserting the new email directly into the DB and your column for ermail ids should be unique so that it throws an exception for duplicate entries.
  16. Hi, Kindly ignore the question. I think the sql is incorrect. Thanks.
  17. HI, Why can't I import a table into my existing DB using the command below: mysql -u root -p mydatabase < file.sql; This has always worked but now I get the following error. mysql version is Thanks !
  18. Hi, No I don't. I did read some posts where they said that these are to be fixed by google at their end but also quite a few which attempted to fix these "irritating" warnings. Hence I thought that I would try and make changes so that these won't appear. I think that the missed error messages, at the very beginning, created a lot of confusion. So i do nothing at all and let google fix these as and when in some future version? Thanks.
  19. Hi, I could have sworn that I posted the error messages but as rightly stated they are not there !😲 Sorry about that. Here are the messages that I receive (15 of them): with different URLS all originating in google. I get these messages in chrome after I deleted the cookies manually and also deleted all the rest in chrome from the settings. In FireFox however, I receive no such messages ?? Thanks !
  20. chrome warnings are the same as in the previous message; Request Header: Response Header Here's all the relevant information I think. The cookies in storage shows samesite as none which was earlier blank. The cookies under Network in devops shows samesite as blank. Why does domain and path shows as N/A? This is how my site invokes the setting of the cookie on my index page. if(!isset($_SESSION)) sess_start(); and sess_start is the code that I posted in my earlier reply. Thanks !
  21. $session_name = 'sec_session_id'; $secure = true; $httponly = true; ini_set('session.use_only_cookies', 1); $cookieParams = session_get_cookie_params(); $cookieParams["domain"] = $cookieParams["domain"]."; SameSite=None"; session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly); session_name($session_name); session_start(); Here's the rest of it.
  22. Oh Damn ! been working on JS last so many days !🤯 I'll get back. Thanks. P.S. Same result with the "." operator. 😒
  23. Hi, This is what I tried since my cookie is set using session_set and get cookie params: $cookieParams = session_get_cookie_params(); $cookieParams["domain"] = $cookieParams["domain"]+"; SameSite=None"; The I used this to set the cookie params using session_set_cookie_params but nogo. How do you think I should inject this then ? Thanks.
×
×
  • 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.