PDA

View Full Version : Is it possible?



Luke
30-01-2011, 05:06 PM
Another question :P

Is it possible to setup an email or something, to update a MySQL database field?
So if i email a word to the address, it would modify the field with that word?

Cheers

Trinity
30-01-2011, 05:23 PM
Yes, it's possible and pretty straightforward.
You could write a php script to connect to the email account, grab the body of the most recent email (you might want to verify it's from the right sender), then update the field. You might also want to check if the most recent email is different to the last time you checked it, just to save you overwriting the field with the same info, but it's up to you.
Then just set up a cron job to run it every hour/five minutes/whatever. Boom, done.

There might be a simpler way, but that method is pretty simple as it is.

Luke
30-01-2011, 05:54 PM
Yes, it's possible and pretty straightforward.
You could write a php script to connect to the email account, grab the body of the most recent email (you might want to verify it's from the right sender), then update the field. You might also want to check if the most recent email is different to the last time you checked it, just to save you overwriting the field with the same info, but it's up to you.
Then just set up a cron job to run it every hour/five minutes/whatever. Boom, done.

There might be a simpler way, but that method is pretty simple as it is.

Right, I understand it, but don't know how to code it -.- Any chance you can point me in the right direction? :P

Cheers

Recursion
30-01-2011, 05:54 PM
If this is for what I think it is, why overcomplicate it with MySQL? You could easily use a flat file.

Luke
30-01-2011, 05:55 PM
Yes it is, and didn't think of that actually - either one will do.

Want to hide these adverts? Register an account for free!