Sure Greg,
Great suggestion, and it almost works. (see below)
The code that sets the value of the$adjustedMembershipExpiryDate variable is:
<?php // code to check and adjust expires date 4-3-15 ?>
<?php if ( $organization_informationRecord['valid_for_one_year_from_date_joined'] = 0 || $organization_informationRecord['valid_for_one_year_from_date_joined'] = '' ):?>
<?php $curr_month = date("n") ?>
<?php $start_month = $organization_informationRecord['start_month'] ?>
<?php $cutoff_month = $organization_informationRecord['cutoff_month'] ?>
<?php $renewal_duration = $organization_informationRecord['renewal_duration'] ?>
<?php
$currentYear = date('Y');
if($curr_month >= $cutoff_month) {
$renewalYear = $currentYear + ($renewal_duration);
}
else {
$renewalYear = $currentYear + ($renewal_duration - 1);
}
$expiryMonth = $start_month-1;
if($expiryMonth < 10) {
$expiryMonth = "0".$expiryMonth;
}
if($expiryMonth == 00) {
$expiryMonth = 12;
}
$testEndDate = $renewalYear. '-'.$expiryMonth.'-01';
$lastDayofMonth = date('t', $testEndDate);
if($expiryMonth == 02) {
$lastDayofMonth = 28;
}
if($expiryMonth == 04 || $expiryMonth == 06 || $expiryMonth == 08 || $expiryMonth == 11) {
$lastDayofMonth = 30;
}
$adjustedMembershipExpiryDate = $renewalYear.'-'.$expiryMonth.'-'.$lastDayofMonth.' 00:00:00';
?>
The variable created (for example) is in the format: 2016-07-31 00:00:00
The code that is inserting the date is:
mysql_query("INSERT INTO `{$TABLE_PREFIX}accounts` SET
first_name = '".mysql_escape( $_REQUEST['first_name'] )."',
middle_initial = '".mysql_escape( $_REQUEST['middle_initial'] )."',
last_name = '".mysql_escape( $_REQUEST['last_name'] )."',
expiresDate = $adjustedMembershipExpiryDate,
neverExpires = '0',
createdDate = NOW(),
updatedDate = NOW(),
createdByUserNum = '0',
updatedByUserNum = '0'")
or die("MySQL Error Creating Record:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
$userNum = mysql_insert_id();
Without the apostrophes, the error thrown is:
MySQL Error Creating Record:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' neverExpires = '0', createdDate = NOW(), ' at line 51
*************************
With the apostrophes, a user record with the correct expiresDate is created, but the following error is thrown (which is in the code that Clair put together recently):
E_NOTICE: A non well formed numeric value encountered
/home2/public_html/serverpath/apptest.php (line 51)
http://www.thedomain.com/apptest.php
I believe that you have the login credentials for this account if you need it (it's the same account as the captcha issue).
the file that is producing this issue is apptest.php
Thanks for checking into this.
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php