Schlo_50 Posted April 25, 2007 Share Posted April 25, 2007 I have been making a calendar and can at the moment add new events to each month storing them in a mySQL database. Now i want to add a link next to each month ( e.g April (click to remove events) which when clicked deletes the events associated with that month. I have three rows, id, month and message. Can someone help please? Thanks! Link to comment https://forums.phpfreaks.com/topic/48587-deleting-rows-in-a-database/ Share on other sites More sharing options...
benjaminbeazy Posted April 25, 2007 Share Posted April 25, 2007 if you're using a link, you have to send the variables via the URL i.e. some_script.php?action=delete&month=MONTH_ID if(isset($_GET['action']){ $action = $_GET[action]; } if(isset($_GET['action']){ $month= $_GET['month']; }else{ $month = bad; } if($action == "delete"){ if(is_numeric($month){ // delete sql query goes here }else{ echo "No month supplied!"; } // redirect here, you dont want users to stay on the same page when you pass URL vars that affect the database } Link to comment https://forums.phpfreaks.com/topic/48587-deleting-rows-in-a-database/#findComment-237905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.