osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Emails - urgent help needed

This is a discussion on Emails - urgent help needed within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hello. I have a conribution that exports all the emails of the subscribers to a csv file. I want it ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Reply

 

LinkBack Thread Tools
  #1  
Old 04-18-2008, 03:14 PM
Lurker
 
Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oslover is on a distinguished road
Default Emails - urgent help needed

Hello.

I have a conribution that exports all the emails of the subscribers to a csv file.
I want it to export all the emails of the customers whose orders' status is processing because i want to notify them about their orders.

Here is the conribution code:

Thank you in advance:
PHP Code:
<?php 
$filename
="addresses.txt";  //.txt is good for import into excel workbook as tab delimited file

// end of configuration!
require('includes/application_top.php');  // gives us SOME security anyway
require_once('includes/configure.php');  // gives us osC database info

header('Content-Type: text/x-csv');
header('Content-Disposition: attachment; filename="' $filename '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

if ( 
mysql_connect DB_SERVER DB_SERVER_USERNAME DB_SERVER_PASSWORD )) { 
    
$sql   "SELECT  customers_firstname, customers_lastname, customers_email_address "
    
$sql .= "FROM customers WHERE customers_newsletter = '1'"
    
$result mysql_db_query DB_DATABASE $sql );
    echo 
"email\tFirst Name\tLast Name\n";
    while ( 
$row mysql_fetch_array($result)) {
        if (
$row[customers_email_address]) {
            echo 
"$row[customers_email_address]\t$row[customers_firstname]\t$row[customers_lastname]\n";
        }
    
    } 

mysql_close (); 
?>

Normally this code should do the job, but it didn't any idea?

PHP Code:
$sql   "SELECT  customers_firstname, customers_lastname, customers_email_address  FROM customers c, orders o WHERE c.customers_id = o.customers_id and orders_status = 2"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 04-18-2008, 10:45 PM
Lurker
 
Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oslover is on a distinguished road
Default Re: Emails - urgent help needed

Hi I tried this code which should work but the exported file contained an error.

This is the error:
PHP Code:
<br />
<
b>Warning</b>:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>/var/www/vhosts/site.com/httpdocs/admin/email_export.php</bon line <b>37</b><br /> 
and this is the code:

PHP Code:
<?php
$filename
="addresses.txt";  //.txt is good for import into excel workbook as tab delimited file

// end of configuration!
require('includes/application_top.php');  // gives us SOME security anyway
require_once('includes/configure.php');  // gives us osC database info

header('Content-Type: text/x-csv');
header('Content-Disposition: attachment; filename="' $filename '"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');

if ( 
mysql_connect DB_SERVER DB_SERVER_USERNAME DB_SERVER_PASSWORD )) {
   
$sql   "SELECT  customers_firstname, customers_lastname, customers_email_address  FROM customers c, orders o      WHERE c.customers_id = o.customers_id and orders_status = 2";
    
$result mysql_db_query DB_DATABASE $sql );
    echo 
"email\tFirst Name\tLast Name\n";
    while ( 
$row mysql_fetch_array($result)) {
        if (
$row[customers_email_address]) {
            echo 
"$row[customers_email_address]\t$row[customers_firstname]\t$row[customers_lastname]\n";
        }
    
    }
}
mysql_close ();
?>

I really hope someone will be kind enough and reply to this post.

Thank you in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Urgent help needed! Coupon total not being passed CC company akasharkbow osCMax v2 Installation issues 1 05-07-2006 12:03 PM
page_parse_time.log error on site Walter osCommerce 2.2 Modification Help 4 11-27-2005 03:14 AM
osCommerce MS2Max from scratch - Urgent help needed! pram0310 osCMax v1.7 Installation 3 12-02-2004 07:22 AM
cc_validation.php - Please, urgent help needed! dos osCommerce 2.2 Modification Help 0 02-18-2003 03:33 PM
Please: Urgent help needed- Editing sideboxes damien2 osCommerce 2.2 Modification Help 4 01-30-2003 03:11 PM


All times are GMT -8. The time now is 08:37 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax