I have a table called product and whenever the value of the field stock = 0 I want to send a notification email to a specific email address. I would like your help guys on how I can implement that and if this is possible. I considered using PHP but my application is a Java application and unfortunately Java is not the best with emails. I just want soemthing that checks the stock value and send an email when stok =0.

Advice will be appreciated.

A trigger can only call MySQL functions. So, unless you build a custom UDF, this is not possible. You could use a trigger to create an email queue table, which you can poll from PHP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.