$thattime
我一直在"迟到"我的数据库甚至认为我改变了我的time
值。
我试图改变价值,仍然得到"迟到"在我的数据库上。我的logintime
列上有s="abdhbdwba"
maxLen=0 # sets the current highest length to 0
current=s[0] # sets the current letter to the first letter (this is the output string)
longest=s[0] # sets the longest letter to the first letter(just for programming sake)
# step through s indices
for i in range(len(s) - 1): # goes over every letter in the string s except the last letter
if s[i + 1] >= s[i]: # checks if the next letter in the string is greater than (in ascii code) the current letter
current += s[i + 1] # if it is, adds the next letter to the current value
if len(current) > maxLen: # if we've got to a sequence that is larger, just set the max length to the length of the sequance
maxLen = len(current) # just lets the max length to the current length
longest = current # just sets the longest to the current value
else:
current=s[i + 1] # just sets the current as is
i += 1 # not sure why this is here?
print ('Longest substring in alphabetical order is: ' + longest) # just prints it out
类型。
有人可以帮助我吗?
感谢。
答案 0 :(得分:1)
i have made a sample of your code to check,
<?php
$ThatTime ="18:50:00";
$time='18:49:00'; // use your db variable , i have used static for demo purpose
if (strtotime($time) > strtotime($ThatTime)) {
// put your db query here
echo 'Present';
}
if (strtotime($time) < strtotime($ThatTime)) {
// put your second db query here
echo 'Late';
}
if (strtotime($time) == strtotime($ThatTime)) {
// put your second db query here
echo 'Same Value';
}
?>
just place this code to check , if it echo present or late then put your query for update.
sorry , i forgot to add for equal to condition, make it as you like in equal to status. hope this helps.