Forum Moderators: coopster

Message Too Old, No Replies

E-mail copy of MySQL update query to self

Text backup of changes made to MySQL table

         

s9901470

1:15 pm on Aug 9, 2005 (gmt 0)

10+ Year Member



Hi

I would like to have an e-mailed copy of the data which my visitors update a MySQL database with.

The existing code is below. I would like to add something underneath along the lines off 'Email a list of all the values q201-q204 to myemail@email.com in comma separated format'. This is just so I can keep an eye on what visitors are doing without having to check the mysql table manually.

Any suggestions? Thank you in advance.

mysql_select_db('quiz');
$query = "UPDATE quiz SET
stamp_i=NOW(),
q201='".$q201."',
q202='".$q202."',
q203='".$q203."',
q204='".$q204."' WHERE uname='".$uname."' ";

lobo235

11:00 pm on Aug 9, 2005 (gmt 0)

10+ Year Member



You could easily mail the query string to yourself which will tell you exactly what got inserted. Just do something like:

mail( 'myemail@mydomain.com', 'Insert Query', $query );

This would send an email to myemail@mydomain.com with the subject 'Insert Query' and the body of the message would be everything in the $query variable.

s9901470

8:47 am on Aug 11, 2005 (gmt 0)

10+ Year Member



That works great! Many thanks.