Forum Moderators: coopster

Message Too Old, No Replies

MySQL data insert and notiify by email

MySQL data insert and notiify by email

         

togethercomms

2:27 pm on Jun 11, 2009 (gmt 0)

10+ Year Member



Hi i was wondering if it is possible to be notified when someone has uploaded something to the MySQL server?

For example; someone uploaded a picture i want the picture to be uploaded and then a notification email comes to me aswell to tell me that something has been uploaded.

Many Thanks

jatar_k

2:37 pm on Jun 11, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



absolutely, you could do it a couple ways

1. include the sending of the email at the end of the upload script

2. use a cron to check if anything new has been added every X amount of time and email you if there is something new

togethercomms

2:40 pm on Jun 11, 2009 (gmt 0)

10+ Year Member



The cron would be good, i have never coome across this before, would it be easy to set up as this job is a cheap job so don't want to spen to much time on it.

Thanks foor your reply

jatar_k

2:45 pm on Jun 11, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if it is available from the host, it isn't always an option. you would search crontab for *nix servers or scheduled tasks for a windows server.

if it's quick then just throw in the email at the end of the upload

maybe something simple like

$to = "test@test.com";
$from .= "From: test@test.com\n";
$from .= "Return-Path: test@test.com\n";
$from .= "Reply-To: test@test.com\n";
$subject = "someone uploaded a new picture";
$message = "someone uploaded a new picture\n\n";
@mail($to,$subject,$message,$from);

just change it to your email, edit the subject and message and that's that

togethercomms

2:49 pm on Jun 11, 2009 (gmt 0)

10+ Year Member



fantastic thank you, i will test this, byut it seems like the normal mailto: php funtion that is used on forms, correct?

Thank you again for your help

jatar_k

2:59 pm on Jun 11, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> normal mailto: php funtion that is used on forms, correct?

I think so, not 100% sure I read that right

>> Thank you

my pleasure