-
Main Forum
-
Suggestion Box
-
Zh Google Map
Zh Google Map
-
MarvinG
-
Topic Author
-
Offline
-
Senior Member
-
Less
More
-
Posts: 41
-
Thank you received: 0
-
-
9 years 2 weeks ago - 9 years 2 weeks ago #6514
by MarvinG
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 2 weeks ago by MarvinG.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 4609
-
Thank you received: 460
-
-
-
-
-
9 years 1 week ago #6528
by Dima
You enter wrong "where" clause for delete clause
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 1 week ago #6529
by MarvinG
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..
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 4609
-
Thank you received: 460
-
-
-
-
-
9 years 1 week ago #6536
by Dima
Hi.
Sorry for delay. I'm very busy and will try (this evening) to check what you should to enter for your delete clause
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 4609
-
Thank you received: 460
-
-
-
-
-
9 years 6 days ago - 9 years 6 days ago #6545
by Dima
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
Last edit: 9 years 6 days 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 6 days ago #6549
by MarvinG
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.
Please Log in or Create an account to join the conversation.
-
Main Forum
-
Suggestion Box
-
Zh Google Map
Time to create page: 0.145 seconds