Jump to content

[SOLVED] Delete past events from PHP/MySQL


guyfromfl

Recommended Posts

There was a post similar to this one but I can't find it right now

 

All this is to do is get rid of past concerts if it is before today.

 

I do have DELETE privelege for the user

 


$today = date("Y-m-d");

// Delete past events
$sql = "DELETE FROM tbl_events WHERE eventDate < '$today')";
$query = mysql_query($sql);


 

no clue why it doesnt work

Link to comment
https://forums.phpfreaks.com/topic/46292-solved-delete-past-events-from-phpmysql/
Share on other sites

Thats your problem, the date is in the wrong format. I would try a unix time stamp and see.

 


$today = time();

// Delete past events
$sql = "DELETE FROM tbl_events WHERE eventDate < '$today'";
$query = mysql_query($sql) or die(mysql_error());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.