seduction city Posted July 17, 2010 Share Posted July 17, 2010 my comment table is getting very large and I am looking for a way to delete some of the old entries without messing with player pages. the table structure is `cm_id``cm_from``cm_to``cm_comment``cm_days``cm_time` what i want to do is delete all older comments where there are more than a count of 30 in cm_to. This is way beyond my SQL knowledge, any help is appreciated Quote Link to comment Share on other sites More sharing options...
iSOS Posted July 17, 2010 Share Posted July 17, 2010 [mysql]mysql_query("DELETE FROM `comments` WHERE (`cm_to` > 30)");[/mysql] I think that's what ya looking for. Quote Link to comment Share on other sites More sharing options...
Dayo Posted July 17, 2010 Share Posted July 17, 2010 can you not add some thing like /////////// UNTESTED \\\\\\\\\\\\\\ $mail=mysql_query("SELECT `cm_id` FROM `comments` ORDER BY `cm_time` ASC)"); if (mysql_num_rows($mail)>30) { $m=mysql_fetch_array(mysql_query("SELECT `cm_id` FROM `comments` ORDER BY `cm_time` ASC LIMIT 0, 1")); mysql_query("DELETE FROM `comments` WHERE `cm_id` =".$m['cm_id']); } btw zeds will delete all posts were the comment is to any one with a higher id then 30 (by the looms of it) Quote Link to comment Share on other sites More sharing options...
seduction city Posted July 19, 2010 Author Share Posted July 19, 2010 can you not add some thing like /////////// UNTESTED \\\\\\\\\\\\\\ $mail=mysql_query("SELECT `cm_id` FROM `comments` ORDER BY `cm_time` ASC)"); if (mysql_num_rows($mail)>30) { $m=mysql_fetch_array(mysql_query("SELECT `cm_id` FROM `comments` ORDER BY `cm_time` ASC LIMIT 0, 1")); mysql_query("DELETE FROM `comments` WHERE `cm_id` =".$m['cm_id']); } btw zeds will delete all posts were the comment is to any one with a higher id then 30 (by the looms of it) I think this is probably what i need. I am not very good with anything but basic scripts. I will go put this into my test area and see what happens......Thanks so much for your assistance! Zed thanks for the effort but that will delete all comments wherever it was sent to userid over 30......basically all the comments in the game. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.