I have two database entries, let's say "reg_users" and "news". The question is that if somethings was changed in the "news" database, the email letter will be sent automatically to all emails which are related to "reg-users" database. So, how can I accomplish this point.
How can I set this process based on daily, weekly or monthly basis?
I have two database entries, let's say "reg_users" and "news". The question is that if somethings was changed in the "news" database, the email letter will be sent automatically to all emails which are related to "reg-users" database. So, how can I accomplish this point.
Simply add the code to send the emails after the code which updates the database. That way, after the database is updated, the emails will be sent.
QUOTE(alex1985 @ Jun 10 2008, 05:40 AM)
How can I set this process based on daily, weekly or monthly basis?
Presumably you mean you want to send out a daily/weekly/monthly list of what has changed? You would need to store the time each news item was last edited in the database. Then write a script that looks for news items edited in the last day/week/month and send out an email with a list of them in it.
To make your script run daily/weekly/monthly, look at cron jobs. Google has plenty of tutorials on getting them working, along with tutorials here on Trap17.
No offence Alex but your going way out of your depth, your thinking too big, start of smaller, do one bit at a time, stop throwing all these "Help Me" posts out and concentrate on one thing rather than piling your plate up with food but cannot eat it all, take it one step at a time rather than plunging in! Not that I mean don't ask for help, you should, you shouldn't have to work it all on your own however, It would be better saying what you want to do , breaking it down in to snippits of code, i.e if, else here and a php require there, and if you get stuck there's always Trap17
I couldn't agree more with kobra's post. You are acting like the code to do this is just some magical function that we are all keeping away from you. I'm sorry but the function send_email_based_on_database($database) doesn't exist! There is also no magical code that we can give you to do this, well I suppose we could but it would be long and not help you at all. You need to first figure out how php works and what it can do for you. You should have figured out by yourself that rvalkass's post would be most efficient, or at least figure out another solution that would work, for example making another database mirror the first database and make a cron job to find differences between them every day/week/month. And then from there you would be able to patch together the small parts of the project for example "How to go about mirroring the database?" well that would be a bit better of a question to ask us, however you should be able to figure out how to do that as well if you know loops. Then comparing the two databases shouldn't be too hard either. Just go row by row and compare the data. Now don't tell me that you are so thick that you couldn't figure that out. If you take a moment to think about the project you want to do you might actually learn something instead of asking us for code that could be implemented in many different ways.
I have two database entries, let's say "reg_users" and "news". The question is that if somethings was changed in the "news" database, the email letter will be sent automatically to all emails which are related to "reg-users" database. So, how can I accomplish this point.
How can I set this process based on daily, weekly or monthly basis?
Go to the line that you have inserted a new entry into news:
CODE
@mysql_query("INSERT INTO news VALUES ('',........ //After this, we must select all members who wants to be informed from reg_users $querymemberstoinform = @mysql_query("SELECT * FROM reg_users WHERE inform_me='1'",$myconnection); //You didn't give the structure of reg_users, so think that there is a coulomb inform_me, and who has the value=1 will be informed.
if (mysql_num_rows($querymemberstoinform )>0) { while ($rsmembers=mysql_fetch_array($querymemberstoinform )) { if (eregi ("^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}$", $rsmembers["email"])) { [i]//we check here if the email address is correct.[/i] $extra="From: Here_write_your_from_name <Here_write_your_from_mail@yourdomain.com> \r\n"; $extra.="Bcc: if_you_want_to_get_a_bbc_copy@youremailaddress.com \r\n"; $extra.="Reply-To: reply_to_name <noreply@yourdomain.com> \r\n"; //$extra.="X-Priority: 1 \r\n"; //if you want to set priority also use here. $extra.="MIME-Version: 1.0 \r\nContent-type: text/html; charset=iso-8859-9 \r\n"; $mailbody="Dear ".$rsmembers["username"]. ", a news has just been added.<br> <a href=\"your_url_to_the_new\">Click here to read the news</a><br> Or content is here: <hr>".$thecontentofthenews."<hr>"; $mailbody.="Information Systems by alex1985;)"; @mail ($rsmembers["email"], $titleofthenews." titled a news has been added", stripslashes($mailbody), "$extra"); } } }
I have used @ character before all functions only in sending mail. Because if there is an error occurs, anything about error will not be displayed.
By the way to send daily, weekly, or monthly: You can use cronjob. But you must write these codes into a new blank php file and before these codes you must run a query which selects the news rows the last 24 hours, last 7 days, last 30 days. Good luck. //Edit: [ b ] and [ i ] bbcodes are working in Code tags, and I have deleted only those.
I have an index array CODE $array[0] = 10; $array[1] = 12; ...
Its kinda late and I'm falling asleep now but I had a quick look through PHP.net, and could not
find what I'm after, Maybe I'm too sleepy, sorry, but if anyone knows off the top of their
head a way to removed members in that array based on its value, i.e. I wanna remove values 12. I
don't really want to do a loop but if I cant find any existing function to do it, then I may
have to. Thanks for any help....
Well, i was just wondering if something simple and basic could be made (like a small map where you
could move around on, like you click up, and your position moves up and reports it to the
database..etc) with co-ordinates in php . Taking the x-axis and the y-axis into consideration.
Things like maps which online games have such as web-based space games or legacy-game.net. Thanks
for any feedback, ~Aldo...
How I use Windows command prompt client and do modifications to my SQL database. If yes, please
write the commads I should know for that. If no, please get me the software with which I can do it.
Topic title modified. Proper English is always required when posting in our forum. ...
I am wondering whether or not you could create a basic client for IRC using PHP. I know that PHP
does have IRC functions which I read about on php.net. I am not quite sure whether or not a client
could be built around this. I do know that there is a CGI IRC client on the web. I use this while I
am on my Wii I am wanting to incorporate a PHP IRC client into my website and use AJAX to
automatically reload the chat. Well, if anybody could help that would be great....
hi there, im working on a performance request system, and i have three tables that im working with
right now. the performances table holds the info about the performance (date, times, status, etc.),
and has two columns, org_type and org_id, which both hold an int value to tell me where the
organization info is. there are two org types which have respective tables, because we collect
different information based on the type of org that is registering. is there any way to select info
from all three tables (dynamically selecting between the two org tables based on org_type,...
Whenever someone registers at my forum, they get this error: Failed sending email :: PHP :: DEBUG
MODE Line : 234 File : emailer.php however, the account will be sucessfully registered. It is
weird because i did not change the original emailer.php at all. O__O||| anyone know whats up with
it?...
I'm trying to work out if it is possible to send variables to a application on server. E.g
send the variable of id which is equal to 10 to an application - test.exe?id=10 Any ideas to see if
this is possible?...
i have a problem sending newsletters....when i send them no1 receives it...i tried sending to the
registered users on my site which im in and i didnt recieve it in my mail...i dont know why this is
happening...it says the newsletter is sent...but we get nothing in our mail... heres the code
QUOTE /************************************************************************/ /* PHP-NUKE:
Web Portal System */ /* ===========================
*/ /* ...
i want to learn how members of a website can send messeges to each other using php since im learning
it. okay i can write in more detail..that for example if users can register on a website , suppose
there are some users on the website , and now i want to learn how they can send messeges to each
other.suppose each user has a unique ID ... and for example if some one has send the messege to
other member of website , then he can know that he has recieved a new messege..something like inbox
on the website where all of his messeges can be stored...lets say same way like on t...
I'm trying to send an attachment using the mail Php function. It gets caught by the email
server with an error. It seems to have a problem with the separator or who knows what. The server
says something like "invalid separator on mime type." The code is: Code: CODE // subject
$subject = "Hello There "; $mime_boundary =
"<<<--==-->>>"; // headers $headers =
"From: " . 'Tom' . " <" . 'texample@aol.com' .
">\r\n"; ...
I know how to send back the check-boxes, so that's not the issue. I have a form that contains a
group of 5 check-boxes. The user could select none, one, all, or any combination in between.
I'm working on form validation right now and am doing most of it server side. The validation is
set so that if the user has to go back all their data is retained. I'm using case statements,
which work wonderfully, but in this circumstance I don't know what would be the best method that
allows for a multitude of combinations. I think there is a possibility of somethi...
Looking for sending, e, mails, based, intervals,
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for sending, e, mails, based, intervals,
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE
forum, Create your own topics, Ask Questions, track topics, setup
subscriptions & notifications and Get a Free Website w/ Email and FTP.