Scan Database for expired accounts and emial user

Codes here !

Moderators: macek, egami, gesf

Blay
New php-forum User
New php-forum User
Posts: 3
Joined: Sun Nov 17, 2002 8:59 pm

Scan Database for expired accounts and emial user

Postby Blay » Sun Nov 17, 2002 9:06 pm

Hi,

I have created a site where you need to create and account. What I need to figure out with some major help is......I need to scan all the accounts stored in the database and when the expiry date is 3 days before expiration I want it to email the person and say your account is soon to be expired please renew......etc

Please help me.....

I can't run CRON Jobs....it is being hosted on Windows 2000 Advanced Server / IIS 5.0.

JerryH
New php-forum User
New php-forum User
Posts: 3
Joined: Wed Nov 06, 2002 5:13 am
Location: Indiana

Postby JerryH » Tue Nov 19, 2002 5:57 pm

Well, to automate the process you could probably use Windows' TaskManager to start a Batch file of some sort. I've never used PHP on windows, but I imagine you can call it from the command line.

Just create a regular php script that has all the DB connections and SQL you need to retrieve a dataset.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Nov 20, 2002 2:52 am

<?
mysql_connect("localhost", "pejone", "pejone");
mysql_select_db("dreamstan");

$date=date("m-d-y");
$today=explode("-", $date);

$days = date ("Y-m-d", mktime (0,0,0, $today['0'], $today[1]-3, $today[2]));

$query=mysql_query("SELECT * FROM `news` WHERE `date` < '$days' AND `is_1_email_send`= '0' ");

while($data=mysql_fetch_array($query))
{
//dont forget to update your data base
//mail function here "$data[email]";
}

?>

<!--include this script to your index page or some of the most popular/viseted pages =) -->

Blay
New php-forum User
New php-forum User
Posts: 3
Joined: Sun Nov 17, 2002 8:59 pm

Postby Blay » Sat Nov 23, 2002 6:54 pm

Thanks for your help!


Return to “mySQL & php coding”

Who is online

Users browsing this forum: No registered users and 1 guest