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'tany 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";





LinkBack URL
About LinkBacks






Bookmarks