?
Solved

Add address_book fields to query in osCommerce

Posted on 2008-10-31
1
Medium Priority
?
284 Views
Last Modified: 2013-12-13
I'm a total newbie to sql and my developer is not available. I need urgently to add certain fields of the address_book table to the code below, so I can export this information including the mailing address:

The fields we have in the address book table that I need here are:

entry_street_address
entry_suburb
entry_postcode
entry_city
entry_state

Can someone help please?
----------------------------------------------------------------------------------
 
require('includes/application_top.php');
 
tep_db_query("truncate table customers_marketing");
 
$customers_query = tep_db_query("select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, i.customers_info_date_account_created, i.customers_info_source_id from " . TABLE_CUSTOMERS . " c left join customers_info i on (i.customers_info_id = c.customers_id) order by i.customers_info_date_account_created desc, c.customers_lastname, c.customers_firstname");
 
while ($customers = tep_db_fetch_array($customers_query)) {
 
$orders_query = tep_db_query("select date_purchased from " . TABLE_ORDERS . " where customers_id = '" . (int)$customers['customers_id'] . "' and orders_status <> '4'");
$orders_result = tep_db_fetch_array($orders_query);
 
$entry_referral = tep_get_sources_name($customers['customers_info_source_id'], $customers['customers_id']);
$entry_referral2 = tep_get_sources_name2($customers['customers_id']);
 
 
//table values
$customers_id = $customers['customers_id'];
$customers_firstname = $customers['customers_firstname'];
$customers_lastname = $customers['customers_lastname'];
$customers_email_address = $customers['customers_email_address'];
 
$customers_info_date_account_created = tep_date_short($customers['customers_info_date_account_created']);
 
$source = $customers['customers_info_source_id'] == '9999' ? 'Other' : stripslashes($entry_referral);
$source_detail = stripslashes($entry_referral2);
 
$orders = tep_db_num_rows($orders_query);
 
$sql_data_array = array('customers_id' => $customers_id,
'customers_firstname' => $customers_firstname,
'customers_lastname' => $customers_lastname,
'customers_email_address' => $customers_email_address,
'customers_info_date_account_created' => $customers_info_date_account_created,
'source' => $source,
'source_detail' => $source_detail,
'orders' => $orders);
 
 
tep_db_perform('customers_marketing', $sql_data_array);
 
}
 
echo "customers_marketing database table filled - export to csv from phpmyadmin";
 
echo '<p><a href="java script:history.back();"><u>Back</u></a>';
?>
-----------------------------------------------------------------------------------------------------

Open in new window

0
Comment
Question by:poemorella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
poemorella earned 0 total points
ID: 22855025
Solved
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question