Hello, I'm building a site that allows users to post comments like facebook. After say, 10 rows ( or 10 INSERT INTO's )I want the 1st row to be deleted as to control space in the data base. Any key words or links would help.
Thanks

There probably isn't a reason to actually delete records.

On the query you use to pull the comments you should add an ORDER BY clause that sorts them by the date they were added to the database (assuming you have a column for this) and then add a LIMIT clause (http://dev.mysql.com/doc/refman/5.1/en/select.html#id848826) so that only the most recent 10 results are shown.

Yes, thank you.
I do have an ORDER BY but my concern was having too much in the data base. I have been working with this for a year now but still more to learn. Is this a valid concern? If so, how should this be controlled?

Got it.

if (mysql_num_rows >10) {
	$deleteRow = mysql_query("DELETE FROM table WHERE user_id = var ORDER BY id LIMIT 1");
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.