« Project home page
my little forum
Log in
Register
Search:
Back to the entry by Auge
Post reply
Reply to the message by
Auge
Name:
E-mail:
(optional, won't be displayed directly)
Leave this field empty:
Homepage:
(optional)
Leave this field empty:
Location:
(optional)
Remember me (cookie)
Category:
General
Project organisation
Technics
Design/Themes
Features
Development
Todo
Bugs
German / Deutsch
Spanish / Español
French / Français
Accessibility/UX
Subject:
Formatting help
skip to input
format text bold
[b]bold text[/b]
format text italic
[i]italic text[/i]
insert hyperlink
[link=http://example.com/]link text[/link] / [link]http://example.com/[/link]
set text color
[color=#rgb]colored text[/color]
font size
[size=small]small text[/size]
[size=large]large text[/size]
insert list
[list][*]list item[/list]
insert image
[img]http://example.com/image.jpg[/img]
left: [img=left]http://example.com/image.jpg[/img]
right: [img=right]http://example.com/image.jpg[/img]
thumbnail: [img=thumbnail]http://example.com/image.jpg[/img]
thumbnail left: [img=thumbnail-left]http://example.com/image.jpg[/img]
thumbnail right: [img=thumbnail-right]http://example.com/image.jpg[/img]
upload image
upload image ...
insert TeX code
[tex]TeX code[/tex]
insert code
[inlinecode]code[/inlinecode]
[code]code[/code]
[code=css]code[/code]
[code=html]code[/code]
[code=javascript]code[/code]
[code=perl]code[/code]
[code=php]code[/code]
[code=sql]code[/code]
[code=xml]code[/code]
:-)
;-)
:-P
:-D
:-|
:-(
:yes:
:no:
:ok:
:lol:
:lol2:
:lol3:
:cool:
:surprised:
:angry:
:crying:
:waving:
:confused:
:lookaround:
:clap:
:love:
:tick:
Message:
> Hello > > I have a next question about the behaviour of the selection of inactive accounts. > > The query to select the affected accounts ([link=https://github.com/ilosuna/mylittleforum/blob/07713c11d179eff6a92935542c6da2037f71ff8b/includes/functions.inc.php#L195]functions.inc.php, currently line 195[/link]) is this one: > > [code=sql] > SELECT > `user_id`, > `user_name`, > `user_email` > FROM `mlf2_userdata` > WHERE `user_lock` = 0 > AND `user_type` = 0 > AND `inactivity_notification` = FALSE > AND (`last_login` - (NOW() - INTERVAL 3 YEAR)) < 0 > ORDER BY `last_login` ASC LIMIT 20; > [/code] > > Especially I am interested in [inlinecode]AND (`last_login` - (NOW() - INTERVAL 3 YEAR)) < 0[/inlinecode]. I tested the query part in phpMyAdmin with these two versions. First one with a [inlinecode]test_date[/inlinecode], that is definitely older than 3 years and the second one with a [inlinecode]test_date[/inlinecode] that is only two years ago. > > [code=sql]SELECT '2017-12-30 12:45:40' AS test_date, (NOW() - INTERVAL 3 YEAR) AS old_date, ('2017-12-30 12:45:40' - (NOW() - INTERVAL 3 YEAR)) AS subtraktion > SELECT '2020-12-30 12:45:40' AS test_date, (NOW() - INTERVAL 3 YEAR) AS old_date, ('2020-12-30 12:45:40' - (NOW() - INTERVAL 3 YEAR)) AS subtraktion[/code] > > These are the results. > > [code]2020-12-30 12:45:40 2019-05-12 20:12:31 -20190512199211 > 2017-12-30 12:45:40 2019-05-12 20:20:15 -20190512199998[/code] > > In both cases I get a warning. > > [code]Warning: #1292 Falscher DOUBLE-Wert gekürzt: '2017-12-30 12:45:40' > /* free translation: shortened wrong DOUBLE value: */ > [/code] > > I think, the logic of the condition is broken. The condition [inlinecode]AND (`last_login` - (NOW() - INTERVAL 3 YEAR)) < 0[/inlinecode] returns a negative value (< 0) (and is therefore [inlinecode]TRUE[/inlinecode]) in every single case. But that's a task for tomorrow. > > Tschö, Auge
E-mail notification on reply of this posting
OK - Submit
Preview