How about a script I made to export a single member group as an example? (Ya it is down and dirty but works)
Substitute what you need for your DB and table(s) in the appropriate places. Disregard the file write and xml stuff.
<?php
$host = 'localhost';
$user = 'Sandi';
$pass = '********';
$database = 'b16';
$member_data = array();
$my_connect = mysql_connect($host, $user, $pass);
if (!$my_connect) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($database, $my_connect) or die("Could not find database.");
$query = "SELECT * FROM ibf_members WHERE mgroup = 7";
$member_group = mysql_query($query, $my_connect) or die("Data not found.");
$num_rows = mysql_num_rows($member_group);
if (!$num_rows) die("Could not find any members.");
while( $row = mysql_fetch_assoc($member_group) )
{
$member_data[] = $row;
}
$fh = fopen("group.xml", "w+");
if($fh==false) die("Unable to create group.xml file");
foreach($member_data as $r)
{
$member_data = explode(',',$r);
$xml_output .= "id_counter, "; // counter set on import
$xml_output .= "'" . $r['name'] . "', ";
$xml_output .= "mgroup, "; // mgroup replaced on import'
$xml_output .= "'" . $r['email'] . "', ";
$xml_output .= $r['joined'] . ", ";
$xml_output .= "'" . $r['ip_address'] . "', ";
// Remaining ibf_member columns deleted for example brevity.
$xml_output .= "\n";
echo $r['members_display_name'] . "<br />";
fwrite($fh, $xml_output);
$xml_output = '';
}
fclose($fh);
mysql_close($my_connect);
echo "members exported successfully";
?>