Hi Experts,

I have a table and I want to check once in a day if some records have been added or removed from this table within last 24hours ,and then send an e-mail to myself of all those added or removed records only .

Any idea about how can this be done?

many Thanks in advance.

Firstly you need to log some table data to compare in future.
Lets say primary key of table.
Create one table table_log which will have all primary key.

id primary_key datetime
1 12,13,14,16,19,20,21 timestamp
2 12,13,14,19,20,21,22,23 timestamp

Now make one php script which will be set in cron job.
Task of php script is as below:
It takes last entry from table_log and export primary_key by ','
Then make a loop to compare with existing table primary_key.
Based on that you can check whether record is deleted or added and you can make an email for that.
Lastly take all primary key from you table and implode it and insert into table table_log for next compare.


Thanks a lot for the reply, but m a little new to php/sql. so would you mind telling me please , how can we set a loop to check two tables against each other using a primary key id ? as you stated in your solution?


Okay dude..
This is with form code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
	mysql_query('SET character_set_results=utf8');
	mysql_query('SET names=utf8');
	mysql_query('SET character_set_client=utf8');
	mysql_query('SET character_set_connection=utf8');
	mysql_query('SET character_set_results=utf8');
	mysql_query('SET collation_connection=utf8_general_ci');
		$sql = "insert into tbl_hindi values ('".$_POST['data']."')";
	$sql = "select * from tbl_hindi";
	$res = mysql_query($sql);		
<form  method="post">
<table width="900%" border="0">
    <td>Add New : <input type="text" name="data" size="20" />
<input type="submit" name="save" value="Save" /></td>
    <td><strong>Hindi Data</strong></td>
  <? while($sar = mysql_fetch_assoc($res)) { ?>
  <? } ?>
commented: fabulous , awsome , thanks +3

Thanks a lot for writing this much long code just for me. I think that you have also solved my problem in past as well. My this problem is also solved.
thanks a lot, i wish i could send you a cup of coffee on daniweb. :-)

[by mistake]

did you send a blank reply? I cant see the message.