Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

does anyone have the function


yesudo

Recommended Posts

Tom,

 

I am trying to include this as part of the where clause in a query:

 

where (bcmod((TO_DAYS(NOW()) - TO_DAYS(membership_start_date)), 30)) = 0

 

but I get this error message:

 

1064 - 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 '((TO_DAYS(NOW()) - TO_DAYS(membership_start_date)), 30)) = 0' a

select customers_id, membership_start_date from cancelled_membership where (bcmod((TO_DAYS(NOW()) - TO_DAYS(membership_start_date)), 30)) = 0

[TEP STOP]

 

Any ideas ?

 

Is it because I am trying to use bcmod in the query clause ?

Your online success is Paramount.

Link to comment
Share on other sites

think I have it:

 

$cancel_query_raw =  "select  customers_id, TO_DAYS(NOW()) - TO_DAYS(membership_start_date) as difference from " . TABLE_CANCELLED_MEMBERSHIP . "";
$cancel_query = tep_db_query($cancel_query_raw);
while ($cancel = tep_db_fetch_array($cancel_query)) 
{
 if (bcmod($cancel['difference'], 30) == 0)

Your online success is Paramount.

Link to comment
Share on other sites

No - now I have it:

 

$cancel_query_raw =  "select  customers_id, TO_DAYS(NOW()) as now, TO_DAYS(membership_start_date) as start_date from " . TABLE_CANCELLED_MEMBERSHIP . "";
$cancel_query = tep_db_query($cancel_query_raw);
while ($cancel = tep_db_fetch_array($cancel_query)) 
{
 $diffdate = $cancel['now'] - $cancel['start_date'];
 $checkit = bcmod($diffdate, 30);
 if ($checkit == 0)

Your online success is Paramount.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...