Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

send mail to postmaster every count of 1000

the mail() function

Moderators: macek, egami, gesf

send mail to postmaster every count of 1000

Postby rytec » Thu Sep 22, 2011 5:41 am

Hello to all, I'm as fresh as someone can be with PHP / MySQL but I do my best and have made a little progress in making a php page for my solarsystem.
I got this far that I can get my data from the dbase and can make some query's which can be shown on the page of my home webserver (running Ubuntu LTS 10.04.1 with Apache2 and PHP5 and Mysql)
I also have made som graphic charts with this wonderful PHPgraphlib option which can be found here : http://www.ebrueggeman.com/phpgraphlib

But now I want go a step further and I want my system to send me (postmaster) a mail or message when the solarsystem has produced 1000kWh.

The first question is how to make the query to do this so that it looks for the total produced kWh in the sql dbase and everytime it reaches 1000, 2000, 3000, etc (maybe this should be in another section on this board?

Then the second question is how to make this automatic or should I do this into another package because I can imagine that if the php webpage is not used it will not load anything and it will not send a mail/message.
I also could just make a vissible countdown on this page that would show the remaining to produce count.
I could take the amount of 1000 minus the already produced amount, but what then if this is done? it should restart with 2000 minus the already produced amount.

I have a lot of it all in my head but to get started with this is making my head turning crazy.
rytec
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Sep 22, 2011 5:24 am

Re: send mail to postmaster every count of 1000

Postby bigjoe11a » Tue Sep 27, 2011 8:26 pm

well I got some of it. So let me see if I'm right on what your trying to do.

Your saying that every time some thing reaches 1000kWh. You want it to send you an email. Am I right.
and it's every time it reaches 1000kWh that you want it to reach 1000kWh. ok. If's that right.

create 2 new fields in your table. call them currcount and currtotal.
You will update currcount every time some one does some thing + 1 or ?, Since I have no idea on what your trying to count. This gets hard. Next, You would update the 2nd field and put 1000 in that field.

so as the currcount goes up and reaches 1000, you would compare the currcount with currtotal. and see if they match. If they do. Then send your self an email and update currtotal by 1000.
and it starts all over again. Do you under stand what I'm saying. and what I mean.

Joe
User avatar
bigjoe11a
New php-forum User
New php-forum User
 
Posts: 128
Joined: Wed Aug 31, 2011 3:55 am
Location: USA

Re: send mail to postmaster every count of 1000

Postby rytec » Wed Sep 28, 2011 2:32 am

Hello Joe,

Great explanation, this sounds really the thing I probably need.
I will explain the issue. We have a solarsystem and the gouvernment here in Belgium pays every 1000kwh an amount to the producer of the power.
But the customer needs to manualy put this notification on the website of the gouvernment.
And it would be very helpful if I would get notified when the solarsystem has reached it's 1000, then 2000, then 3000, etcetera.
So I think your solution would help. But how to get this in a code? I can simply do a query to mysql dbase where this power production is inputted every 15 mins. This result can be queried easily but how to do this currcount and currtotal?

thanks for your time already.
Ryan
rytec
New php-forum User
New php-forum User
 
Posts: 5
Joined: Thu Sep 22, 2011 5:24 am

Re: send mail to postmaster every count of 1000

Postby bigjoe11a » Wed Sep 28, 2011 3:12 am

You can load PHPMyAdmin in, and create a new table if your wanted too. Or you could just alter a table that you all ready have. I think your best bet is just to use a new table.

call the table
'solarsystem_count
and then create 2 new fields
currcount
currtotal

Then when the page loads. Update the fields as needed. Remember. You need to compare each field with each other. When the match. Then you send your self a email. Then you would reset currcount to 0 and then you would add a 1000 to currtotal. So adding a 1000 to currtotal would then change the value that you have to compare currcount too.

does that help ?
User avatar
bigjoe11a
New php-forum User
New php-forum User
 
Posts: 128
Joined: Wed Aug 31, 2011 3:55 am
Location: USA


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron