osCmax v2.5 User Manual
Results 1 to 2 of 2

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 ...

      
  1. #1
    Lurker
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0


    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"

  2. #2
    Lurker
    Join Date
    Apr 2008
    Posts
    2
    Rep Power
    0


    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

Similar Threads

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •