Thread: HELP!!!!!!!!!!!
View Single Post
  #3  
Old 06-11-2003, 03:51 PM
  kpriest's Avatar 
kpriest kpriest is offline
 

eXpert
  
Join Date: Apr 2003
Location: Seattle, WA
Posts: 263
 

Default

You can use this code I modified from one I created for another purpose:

Code:
<?php $connection = mysql_connect('localhost', 'YOUR_DB_USERNAME', 'YOUR_DB_PASSWORD'); $db = mysql_select_db("YOUR_DB_NAME",$connection) or die("Could not connect to SQL db"); $sql = "SELECT xcart_customers.firstname, xcart_customers.lastname, xcart_maillist.email FROM xcart_customers INNER JOIN xcart_maillist ON xcart_customers.email = xcart_maillist.email"; $sql_result = mysql_query($sql,$connection) or die ("Couldn't Execute"); echo " <table width='100%' border='1' cellspacing='2' cellpadding='0'>"; echo " <tr> <td>First Name</td> <td>Last Name</td> <td>Email</td> </tr>"; while ($row = mysql_fetch_array($sql_result)) { $firstname = $row["firstname"]; $lastname = $row["lastname"]; $email = $row["email"]; echo " <tr> <td>$firstname </td> <td>$lastname </td> <td>$email </td> </tr>"; } echo "</table>"; mysql_free_result($sql_result); mysql_close($connection); ?>

This pulls the newsletter email addresses out as well as linking to the customer table and getting the first and last name.

Copy this into a text file, fill in your specific database information, save as newsletter_maillist.php or something like that, then post it up in a secure folder on your site (.htaccess protected or something) and just call it up by URL:http://www.yoursite.com/yoursecurefolder/newsletter_maillist.php

A better way would be to use the auth.php and config.php to get access to the db, but I couldn't figure out how to incorporate them into what I was trying to do. I'm fairly new to PHP and MySQL. Maybe funky can add advice on this and how to then assign to smarty if he's so inclined...

hth
__________________
-Ken
X-Cart User / Developer Since April 2003
(Varying versions, multiple client sites, 3.x through 4.4.x)
www.pointbweb.com
Reply With Quote