How to set a time period of 10 minutes in a MySQL
I have a script run by a cronjob, it needs to send a message to the user for notification 10 minutes before the time recorded by the user (for example, the user recorded time at 14:00:00 and the message should be sent to 13:50:00)
$my_base = mysqli_query($db,"
SELECT p.*
, u.uUsername
, u.name as userName
, u.email as userEmail
, u.lang
from my_table p
JOIN my_table_User u
ON p.userId = u.userId
WHERE p.column_1 = 'my_table'
AND realized = 0
AND p.expiry_date = CURDATE()
AND p.expiry_time >= DATE_SUB(NOW(), INTERVAL 10 MINUTE
)") or die("Failed to fetch data");
mysql cron
add a comment |
I have a script run by a cronjob, it needs to send a message to the user for notification 10 minutes before the time recorded by the user (for example, the user recorded time at 14:00:00 and the message should be sent to 13:50:00)
$my_base = mysqli_query($db,"
SELECT p.*
, u.uUsername
, u.name as userName
, u.email as userEmail
, u.lang
from my_table p
JOIN my_table_User u
ON p.userId = u.userId
WHERE p.column_1 = 'my_table'
AND realized = 0
AND p.expiry_date = CURDATE()
AND p.expiry_time >= DATE_SUB(NOW(), INTERVAL 10 MINUTE
)") or die("Failed to fetch data");
mysql cron
See meta.stackoverflow.com/questions/333952/…
– Strawberry
Dec 31 '18 at 13:21
Did you mean cronjob should send the notification to the user before 10 minutes of record expiry_time? And the problem is related to cronjob though the given query is working fine?
– Lalit
Dec 31 '18 at 16:32
add a comment |
I have a script run by a cronjob, it needs to send a message to the user for notification 10 minutes before the time recorded by the user (for example, the user recorded time at 14:00:00 and the message should be sent to 13:50:00)
$my_base = mysqli_query($db,"
SELECT p.*
, u.uUsername
, u.name as userName
, u.email as userEmail
, u.lang
from my_table p
JOIN my_table_User u
ON p.userId = u.userId
WHERE p.column_1 = 'my_table'
AND realized = 0
AND p.expiry_date = CURDATE()
AND p.expiry_time >= DATE_SUB(NOW(), INTERVAL 10 MINUTE
)") or die("Failed to fetch data");
mysql cron
I have a script run by a cronjob, it needs to send a message to the user for notification 10 minutes before the time recorded by the user (for example, the user recorded time at 14:00:00 and the message should be sent to 13:50:00)
$my_base = mysqli_query($db,"
SELECT p.*
, u.uUsername
, u.name as userName
, u.email as userEmail
, u.lang
from my_table p
JOIN my_table_User u
ON p.userId = u.userId
WHERE p.column_1 = 'my_table'
AND realized = 0
AND p.expiry_date = CURDATE()
AND p.expiry_time >= DATE_SUB(NOW(), INTERVAL 10 MINUTE
)") or die("Failed to fetch data");
$my_base = mysqli_query($db,"
SELECT p.*
, u.uUsername
, u.name as userName
, u.email as userEmail
, u.lang
from my_table p
JOIN my_table_User u
ON p.userId = u.userId
WHERE p.column_1 = 'my_table'
AND realized = 0
AND p.expiry_date = CURDATE()
AND p.expiry_time >= DATE_SUB(NOW(), INTERVAL 10 MINUTE
)") or die("Failed to fetch data");
$my_base = mysqli_query($db,"
SELECT p.*
, u.uUsername
, u.name as userName
, u.email as userEmail
, u.lang
from my_table p
JOIN my_table_User u
ON p.userId = u.userId
WHERE p.column_1 = 'my_table'
AND realized = 0
AND p.expiry_date = CURDATE()
AND p.expiry_time >= DATE_SUB(NOW(), INTERVAL 10 MINUTE
)") or die("Failed to fetch data");
mysql cron
mysql cron
edited Dec 31 '18 at 23:32
Lalit
12419
12419
asked Dec 31 '18 at 12:32
MisionarMisionar
66
66
See meta.stackoverflow.com/questions/333952/…
– Strawberry
Dec 31 '18 at 13:21
Did you mean cronjob should send the notification to the user before 10 minutes of record expiry_time? And the problem is related to cronjob though the given query is working fine?
– Lalit
Dec 31 '18 at 16:32
add a comment |
See meta.stackoverflow.com/questions/333952/…
– Strawberry
Dec 31 '18 at 13:21
Did you mean cronjob should send the notification to the user before 10 minutes of record expiry_time? And the problem is related to cronjob though the given query is working fine?
– Lalit
Dec 31 '18 at 16:32
See meta.stackoverflow.com/questions/333952/…
– Strawberry
Dec 31 '18 at 13:21
See meta.stackoverflow.com/questions/333952/…
– Strawberry
Dec 31 '18 at 13:21
Did you mean cronjob should send the notification to the user before 10 minutes of record expiry_time? And the problem is related to cronjob though the given query is working fine?
– Lalit
Dec 31 '18 at 16:32
Did you mean cronjob should send the notification to the user before 10 minutes of record expiry_time? And the problem is related to cronjob though the given query is working fine?
– Lalit
Dec 31 '18 at 16:32
add a comment |
1 Answer
1
active
oldest
votes
please follow this query to find the record comes in 10 minnutes
SELECT username
FROM users
WHERE created_on BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
like in your case this should work
SELECT p.*, u.uUsername, u.name as userName, u.email as userEmail,
u.lang frommy_table
p INNER JOINmy_table_User
u ON p.userId =
u.userId WHERE p.column_1 = 'my_table' AND realized = 0 AND
p.expiry_date
= CURDATE() AND p.expiry_time
BETWEEN NOW() +
INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53987567%2fhow-to-set-a-time-period-of-10-minutes-in-a-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
please follow this query to find the record comes in 10 minnutes
SELECT username
FROM users
WHERE created_on BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
like in your case this should work
SELECT p.*, u.uUsername, u.name as userName, u.email as userEmail,
u.lang frommy_table
p INNER JOINmy_table_User
u ON p.userId =
u.userId WHERE p.column_1 = 'my_table' AND realized = 0 AND
p.expiry_date
= CURDATE() AND p.expiry_time
BETWEEN NOW() +
INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
add a comment |
please follow this query to find the record comes in 10 minnutes
SELECT username
FROM users
WHERE created_on BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
like in your case this should work
SELECT p.*, u.uUsername, u.name as userName, u.email as userEmail,
u.lang frommy_table
p INNER JOINmy_table_User
u ON p.userId =
u.userId WHERE p.column_1 = 'my_table' AND realized = 0 AND
p.expiry_date
= CURDATE() AND p.expiry_time
BETWEEN NOW() +
INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
add a comment |
please follow this query to find the record comes in 10 minnutes
SELECT username
FROM users
WHERE created_on BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
like in your case this should work
SELECT p.*, u.uUsername, u.name as userName, u.email as userEmail,
u.lang frommy_table
p INNER JOINmy_table_User
u ON p.userId =
u.userId WHERE p.column_1 = 'my_table' AND realized = 0 AND
p.expiry_date
= CURDATE() AND p.expiry_time
BETWEEN NOW() +
INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
please follow this query to find the record comes in 10 minnutes
SELECT username
FROM users
WHERE created_on BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
like in your case this should work
SELECT p.*, u.uUsername, u.name as userName, u.email as userEmail,
u.lang frommy_table
p INNER JOINmy_table_User
u ON p.userId =
u.userId WHERE p.column_1 = 'my_table' AND realized = 0 AND
p.expiry_date
= CURDATE() AND p.expiry_time
BETWEEN NOW() +
INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
answered Dec 31 '18 at 13:17
Pervaiz IqbalPervaiz Iqbal
858
858
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
add a comment |
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
Thank you for your reply, but I did not specify the following, it is necessary that the script be executed only in the period from 13:50:00 to 14:00:00, the script can't be executed before and after the specified values. With your solution, the script is executed after 14:00:00. Please help, tnx!!!
– Misionar
Dec 31 '18 at 13:39
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
this part should fulfill ur period requirement i blieve BETWEEN NOW() + INTERVAL 0 MINUTE AND NOW() + INTERVAL 10 MINUTE
– Pervaiz Iqbal
Jan 1 at 6:10
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
@Misionar mark resolved the question please
– Pervaiz Iqbal
Jan 3 at 5:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53987567%2fhow-to-set-a-time-period-of-10-minutes-in-a-mysql%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
See meta.stackoverflow.com/questions/333952/…
– Strawberry
Dec 31 '18 at 13:21
Did you mean cronjob should send the notification to the user before 10 minutes of record expiry_time? And the problem is related to cronjob though the given query is working fine?
– Lalit
Dec 31 '18 at 16:32