Jump to content

Help


affordit

Recommended Posts

You've tried to use the php date() function in your string. You cannot do that. You must concatenate(join) the returned value of the function with the rest of the string:

 

<?php
$query = "select * from test WHERE end_date = '".date('Y-m-d', strtotime('+ 5 days'))."'";
?>

 

Alternatively, see the the mysql date and time functions

Link to comment
Share on other sites

<?php
include("sharons_dbinfo.inc.php");
mysql_connect(mysql,$name,$password);
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select * from test WHERE end_date = '" . date('Y-m-d', strtotime('+ 5 days')) . "'";
$result=mysql_query($query) or die (mysql_error());
$num=mysql_numrows($result); 

mysql_close();

$i=0;
while ($i < $num) {
$company=mysql_result($result,$i,"company");
$name=mysql_result($result,$i,"name");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$phone=mysql_result($result,$i,"phone");
$acct_num=mysql_result($result,$i,"acct_num");
$email=mysql_result($result,$i,"email");
$start_date=mysql_result($result,$i,"start_date");
$end_date=mysql_result($result,$i,"end_date");
$remind_date=mysql_result($result,$i,"remind");
$lost_password=mysql_result($result,$i,"lost_password");
$lost_password_answer=mysql_result($result,$i,"lost_password_answer");

$to = "$email"; 
$subject = "Your Subscription is about to expire"; 
$message="This mail was sent to you because your subscrption with Affordable Everything will expire on $end_date.\nYou can login to your account and use the link at the top of the page to renew your registration. If you let your subscription lapse, Your information and ads you have placed will be deleted and you will have to reregister and enter them all again.";
$headers = "From: subscriptions@affordit.us"; 
$sent = mail($to, $subject, $message, $headers) ; 
if($sent) 
{print "Your mail was sent successfully"; }
else 
{print "We encountered an error sending your mail"; }



++$i;
} 
?>

Link to comment
Share on other sites

try this tell us what it says:

 

<?php
include("sharons_dbinfo.inc.php");
mysql_connect(mysql,$name,$password) or die(mysql_error());
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select * from test WHERE end_date = '" . date('Y-m-d', strtotime('+ 5 days')) . "'";
$result=mysql_query($query) or die (mysql_error());
$num=mysql_numrows($result); 

print_r(mysql_fetch_array($result));

mysql_close();

$i=0;
while ($i < $num) {
$company=mysql_result($result,$i,"company");
$name=mysql_result($result,$i,"name");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$phone=mysql_result($result,$i,"phone");
$acct_num=mysql_result($result,$i,"acct_num");
$email=mysql_result($result,$i,"email");
$start_date=mysql_result($result,$i,"start_date");
$end_date=mysql_result($result,$i,"end_date");
$remind_date=mysql_result($result,$i,"remind");
$lost_password=mysql_result($result,$i,"lost_password");
$lost_password_answer=mysql_result($result,$i,"lost_password_answer");

$to = "$email"; 
$subject = "Your Subscription is about to expire"; 
$message="This mail was sent to you because your subscrption with Affordable Everything will expire on $end_date.\nYou can login to your account and use the link at the top of the page to renew your registration. If you let your subscription lapse, Your information and ads you have placed will be deleted and you will have to reregister and enter them all again.";
$headers = "From: subscriptions@affordit.us"; 
$sent = mail($to, $subject, $message, $headers) ; 
if($sent) 
{print "Your mail was sent successfully"; }
else 
{print "We encountered an error sending your mail"; }



++$i;
} 
?>

Link to comment
Share on other sites

try this tell us what it says (its either query or display_errors() is set off)

 

<?php
include("sharons_dbinfo.inc.php");
mysql_connect(mysql,$name,$password) or die(mysql_error());
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select * from test";
$result=mysql_query($query) or die (mysql_error());
$num=mysql_numrows($result); 

print_r(mysql_fetch_array($result)); exit(); // debug lines

mysql_close();

$i=0;
while ($i < $num) {
$company=mysql_result($result,$i,"company");
$name=mysql_result($result,$i,"name");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$phone=mysql_result($result,$i,"phone");
$acct_num=mysql_result($result,$i,"acct_num");
$email=mysql_result($result,$i,"email");
$start_date=mysql_result($result,$i,"start_date");
$end_date=mysql_result($result,$i,"end_date");
$remind_date=mysql_result($result,$i,"remind");
$lost_password=mysql_result($result,$i,"lost_password");
$lost_password_answer=mysql_result($result,$i,"lost_password_answer");

$to = "$email"; 
$subject = "Your Subscription is about to expire"; 
$message="This mail was sent to you because your subscrption with Affordable Everything will expire on $end_date.\nYou can login to your account and use the link at the top of the page to renew your registration. If you let your subscription lapse, Your information and ads you have placed will be deleted and you will have to reregister and enter them all again.";
$headers = "From: subscriptions@affordit.us"; 
$sent = mail($to, $subject, $message, $headers) ; 
if($sent) 
{print "Your mail was sent successfully"; }
else 
{print "We encountered an error sending your mail"; }



++$i;
} 
?>

Link to comment
Share on other sites

<?php
mysql_connect(mysql,$name,$password) or die(mysql_error());
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select * from test";
$result=mysql_query($query) or die (mysql_error());
$num=mysql_num_rows($result); 

print_r(mysql_fetch_array($result)); exit(); // debug lines

mysql_close();

$i=0;
while ($i < $num) {
$company=mysql_result($result,$i,"company");
$name=mysql_result($result,$i,"name");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$phone=mysql_result($result,$i,"phone");
$acct_num=mysql_result($result,$i,"acct_num");
$email=mysql_result($result,$i,"email");
$start_date=mysql_result($result,$i,"start_date");
$end_date=mysql_result($result,$i,"end_date");
$remind_date=mysql_result($result,$i,"remind");
$lost_password=mysql_result($result,$i,"lost_password");
$lost_password_answer=mysql_result($result,$i,"lost_password_answer");

$to = "$email"; 
$subject = "Your Subscription is about to expire"; 
$message="This mail was sent to you because your subscrption with Affordable Everything will expire on $end_date.\nYou can login to your account and use the link at the top of the page to renew your registration. If you let your subscription lapse, Your information and ads you have placed will be deleted and you will have to reregister and enter them all again.";
$headers = "From: subscriptions@affordit.us"; 
$sent = mail($to, $subject, $message, $headers) ; 
if($sent) 
{print "Your mail was sent successfully"; }
else 
{print "We encountered an error sending your mail"; }



++$i;
} 
?>

 

Try that... you may want to put Error report ALL on ... just to get a bigger answer of errors.

Link to comment
Share on other sites

your query is not returning any MATCHES or RESULTS, there are no entries where end_date = 2008-02-23,

 

the code is fine, your query will return rows where the DATE/end_date field equals 5 days in the future... is this what your trying to do?

 

 

try this and copy and paste the result from the browser source exactly.

 

<?php
include("sharons_dbinfo.inc.php");
mysql_connect(mysql,$name,$password) or die(mysql_error());
@mysql_select_db($database) or die( "Unable to select database"); 

//
// CHANGE QUERY TO GRAB THE ID
//
$query = "select `end_date` from test LIMIT 50";
$result=mysql_query($query) or die (mysql_error());
$num=mysql_numrows($result); 

print_r(mysql_fetch_array($result)); exit();

mysql_close();

$i=0;
while ($i < $num) {
$company=mysql_result($result,$i,"company");
$name=mysql_result($result,$i,"name");
$address=mysql_result($result,$i,"address");
$city=mysql_result($result,$i,"city");
$state=mysql_result($result,$i,"state");
$zip=mysql_result($result,$i,"zip");
$phone=mysql_result($result,$i,"phone");
$acct_num=mysql_result($result,$i,"acct_num");
$email=mysql_result($result,$i,"email");
$start_date=mysql_result($result,$i,"start_date");
$end_date=mysql_result($result,$i,"end_date");
$remind_date=mysql_result($result,$i,"remind");
$lost_password=mysql_result($result,$i,"lost_password");
$lost_password_answer=mysql_result($result,$i,"lost_password_answer");

$to = "$email"; 
$subject = "Your Subscription is about to expire"; 
$message="This mail was sent to you because your subscrption with Affordable Everything will expire on $end_date.\nYou can login to your account and use the link at the top of the page to renew your registration. If you let your subscription lapse, Your information and ads you have placed will be deleted and you will have to reregister and enter them all again.";
$headers = "From: subscriptions@affordit.us"; 
$sent = mail($to, $subject, $message, $headers) ; 
if($sent) 
{print "Your mail was sent successfully"; }
else 
{print "We encountered an error sending your mail"; }



++$i;
} 
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.