- Posts: 41
- Thank you received: 0
Zh Google Map
- MarvinG
- Topic Author
- Offline
- Senior Member
Less
More
9 years 7 months ago - 9 years 7 months ago #6514
by MarvinG
Replied by MarvinG on topic Zh Google Map
I just got it working but instead of deleting entry older than 55mins, it deleted all entries... even those who are 1 min old lol
Last edit: 9 years 7 months ago by MarvinG.
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
9 years 7 months ago #6528
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Zh Google Map
You enter wrong "where" clause for delete clause
Don't forget support my developments: post review in JED , donate , help with translation
The following user(s) said Thank You: MarvinG
Please Log in or Create an account to join the conversation.
- MarvinG
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 0
9 years 7 months ago #6529
by MarvinG
Replied by MarvinG on topic Zh Google Map
Hi Dima,
I set the command like this:
$sql = "DELETE FROM f58dq_zhgooglemaps_markers WHERE `createddate` <= DATE_SUB(NOW(), INTERVAL 1 HOUR)";
But it still delete the whole entries every hour even though some entries was 5mins old..
I set the command like this:
$sql = "DELETE FROM f58dq_zhgooglemaps_markers WHERE `createddate` <= DATE_SUB(NOW(), INTERVAL 1 HOUR)";
But it still delete the whole entries every hour even though some entries was 5mins old..
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
9 years 7 months ago #6536
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Zh Google Map
Hi.
Sorry for delay. I'm very busy and will try (this evening) to check what you should to enter for your delete clause
Sorry for delay. I'm very busy and will try (this evening) to check what you should to enter for your delete clause
Don't forget support my developments: post review in JED , donate , help with translation
Please Log in or Create an account to join the conversation.
- Dima
- Offline
- Platinum Member
9 years 7 months ago - 9 years 7 months ago #6545
by Dima
Don't forget support my developments: post review in JED , donate , help with translation
Replied by Dima on topic Zh Google Map
Hi
Sorry for delay. I was busy.
I don't understand, what you want. Look at my images.
I inserted placemarks
I show select of my placemarks, sorted by created date descent
After that let's get old placemarks, ie it's time older that 1 hour
Look at data
Ie this placemarks have to be deleted by yours wish
And check results
Ie we finally delete all placemarks which is older than one hour
If try to execute again, I'll get
Sorry for delay. I was busy.
I don't understand, what you want. Look at my images.
I inserted placemarks
I show select of my placemarks, sorted by created date descent
After that let's get old placemarks, ie it's time older that 1 hour
Look at data
Ie this placemarks have to be deleted by yours wish
And check results
Ie we finally delete all placemarks which is older than one hour
If try to execute again, I'll get
Don't forget support my developments: post review in JED , donate , help with translation
Last edit: 9 years 7 months ago by Dima.
The following user(s) said Thank You: MarvinG
Please Log in or Create an account to join the conversation.
- MarvinG
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 0
9 years 7 months ago #6549
by MarvinG
Replied by MarvinG on topic Zh Google Map
Hi Dima
But this is when you do it Manually in Phpmyadmin.
I am talking about Cron.
I created a file and put it in my root directory, then i set cron.
My file looks like this:
--
<?php
$servername = "xxxx";
$username = "xxxx";
$password = "xxxx";
$dbname = "xxxx";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// sql to delete a record
$sql = "DELETE FROM f58dq_zhgooglemaps_markers WHERE `createddate` <= DATE_SUB(NOW(), INTERVAL 1 HOUR)";
if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . $conn->error;
}
$conn->close();
?>
When cron execute the task, it not only deleted entries older than 1 month but all my entries.
I am trying to automate everything. When we go through summer season in the indian ocean, i'll not have to necessary time to delete entried manually.
But this is when you do it Manually in Phpmyadmin.
I am talking about Cron.
I created a file and put it in my root directory, then i set cron.
My file looks like this:
--
<?php
$servername = "xxxx";
$username = "xxxx";
$password = "xxxx";
$dbname = "xxxx";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// sql to delete a record
$sql = "DELETE FROM f58dq_zhgooglemaps_markers WHERE `createddate` <= DATE_SUB(NOW(), INTERVAL 1 HOUR)";
if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . $conn->error;
}
$conn->close();
?>
When cron execute the task, it not only deleted entries older than 1 month but all my entries.
I am trying to automate everything. When we go through summer season in the indian ocean, i'll not have to necessary time to delete entried manually.
Please Log in or Create an account to join the conversation.
Time to create page: 0.211 seconds