How to Unload all Member Names and Email Addresses ...

Started by aegersz, August 22, 2016, 06:21:27 PM

Previous topic - Next topic

aegersz

... into a flat file as i'd like to send people emails from the command line.

is there an easy way to do this, like:

Member1 Email_address,
Member2 Email_address,
etc.
The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

aegersz

i worked it out !

<?php
$servername 
"localhost";
$username "root";
$password "XXXXXXXX";
$dbname "smf209";

// Create connection
$conn = new mysqli($servername$username$password$dbname);
// Check connection
if ($conn->connect_error) {
    die(
"Connection failed: " $conn->connect_error);
}

$sql "SELECT member_name, email_address FROM smf209_members";
$result $conn->query($sql);

if (
$result->num_rows 0) {
    
// output data of each row
    
while($row $result->fetch_assoc()) {
        echo 
$row["member_name"]. " " $row["email_address"]. PHP_EOL;
    }
} else {
    echo 
"0 results";
}
$conn->close();
?>

The configuration of my Linux VPS (SMF 2.0 with 160+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Advertisement: