\n"; echo " window.close();\n"; echo "\n "; } // include_once 'header.html'; // include_once 'modules/comFunctions.php'; include_once 'modules/config.php'; // include_once 'modules/sql.php'; $mLink = mysql_connect($_SESSION['instance']['mdbIfce'], $_SESSION['instance']['mdbUser'], $_SESSION['instance']['mdbPass']) or die("Could not connect to MySQL server [sql.php: 13] [dbName=$dbName; dbUser=$dbUser; dbPswrd=$dbPswrd; dbInterface=$dbInterface]"); mysql_select_db($_SESSION['instance']['mdbName'], $mLink) or die("Could not select database"); $q = "select * from headers where tid='".$_REQUEST['export']."'"; if (($headerdat = mysql_query($q, $mLink)) !== false) { $headerdat = mysql_fetch_assoc($headerdat); header('Content-type: text/plain'); header('Content-Disposition: attachment; filename="export.sqe"'); echo $_REQUEST['export']."|"; foreach($headerdat as $k => $v) { if ($arg) $arg .= ", "; $arg .= "$k = '$v'"; } echo "replace into headers set $arg|"; $q = "select * from clientdat where cCode='".$headerdat['cCode']."'"; if (($clientdat = mysql_query($q, $mLink)) !== false) { $clientdat = mysql_fetch_assoc($clientdat); $arg = ""; foreach($clientdat as $k => $v) { if ($arg) $arg .= ", "; $arg .= "$k = '$v'"; } echo "replace into clientdat set $arg"; } } exit; ?>