Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
OSC Newsletter Help - Newsletter.php count help
Old 09-28-2009, 03:09 AM OSC Newsletter Help - Newsletter.php count help
jzm
Junior Talker

Posts: 3
Name: Jess
Trades: 0
I have the following code:

CODE
$mail_query = tep_db_query("select count(*) as count from " . visitors . " where receive = '1' ");
$mail_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_newsletter = '1' ");



But its only counting from the visitors table.

Why is this?
jzm is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-28-2009, 06:34 AM Re: OSC Newsletter Help - Newsletter.php count help
lizciz's Avatar
Webmaster Talker

Posts: 744
Name: Mattias Nordahl
Location: Sweden
Trades: 0
First off, is 'visitors' and 'TABLE_CUSTOMERS' defined constants? If the table name actually is 'visitors' it should be withing the string, as in

"select count(*) as count from visitors where receive = '1' "

If it is a variable you have forgotten the $, then it should be $visitors. The same thing goes for TABLE_CUSTOMERS. But since constants are normally made in upper case, I guess it actually is a constant(?).

Now to your question:

In your page, is the code written as it is above, with the two queries written next to each other? Cause you are storing the result in the same variable ($mail_query), so only the last one will be saved.

Is there any records in the TABLE_CUSTOMERS table? If there aren't any rows the count() will return zero. And are there any records with the field customers_newsletter set to '1'?

Finally, perhaps the most important question, are you getting any errors or warnings? If you are not, make sure you are not surpressing error messages. If there are still no errors the probelm probably lies in the database tables, perhaps there aren't any rows.
__________________
34343639363436653237373432303635373837303635363337 34323037343638363137343263323036343639363432303739 366637353366
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 09-28-2009, 06:53 AM Re: OSC Newsletter Help - Newsletter.php count help
jzm
Junior Talker

Posts: 3
Name: Jess
Trades: 0
First off, is 'visitors' and 'TABLE_CUSTOMERS' defined constants? No

If the table name actually is 'visitors' it should be withing the string, as in
"select count(*) as count from visitors where receive = '1' "

Fixed

If it is a variable you have forgotten the $, then it should be $visitors. The same thing goes for TABLE_CUSTOMERS. But since constants are normally made in upper case, I guess it actually is a constant(?).

I have made the table to create a email only newsletter joining system and have not defined it anywhere within oscommerce.

Now to your question:

In your page, is the code written as it is above, with the two queries written next to each other? Cause you are storing the result in the same variable ($mail_query), so only the last one will be saved.

Ok I think thats were I am going wrong.

Is there any records in the TABLE_CUSTOMERS table? If there aren't any rows the count() will return zero. And are there any records with the field customers_newsletter set to '1'?

Yes I have set 1 in both tables so there are records.

Finally, perhaps the most important question, are you getting any errors or warnings?
If you are not, make sure you are not surpressing error messages. If there are still no errors the probelm probably lies in the database tables, perhaps there aren't any rows.
None
jzm is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to OSC Newsletter Help - Newsletter.php count help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23145 seconds with 12 queries