Jump to content

[SOLVED] Auto delete all rows for table name "chess" when it reach 800 rows


sungpeng

Recommended Posts

Ok... it seems triggers might be a bit too sophisticated tool for you at this moment.

 

How about php code like this

 

<?php

$query = "SELECT COUNT(*) AS rowCount FROM chess";
$result =  mysql_query($query);
$row = mysql_fetch_assoc($result);

if ($row['rowCount'] >= 500) {
  $query = "TRUNCATE TABLE chess";
  mysql_query($query);
}

 

 

Note that you need to have DROP privilege for `chess` table to be able to use TRUNCATE.

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.