emailing informix query results

Hi I am trying to setup a php script that will email me the results of a query daily. I am new to php and am using the code below which will send the email but when I recieve the email it just has a count of the number of rows in the result. Any help is appreciated, thanks Phil

<?php // create connection putenv("INFORMIXSERVER=hermes"); $connection = ifx_connect("finplus", "web", "pass"); // test connection if (!$connection) { echo "Couldn't make a connection!"; exit; } // create SQL statement $sql = "Select (D.empl_no) as Employee_No, (E.l_name) as Last_Name, (E.f_name) as First_Name, (S.description) as MISSING_INFORMATION, (E.hire_date) as HIRE_DATE FROM addempldetail D INNER JOIN addemplsteps S on S.proc_step = D.proc_step INNER JOIN employee E on D.empl_no = E.empl_no where D.complete = 0 and required = 1 GROUP BY D.empl_no, E.l_name, E.f_name, S.description, E.hire_date ORDER BY hire_date"; // execute SQL query and get result $sql_result = ifx_query($sql,$connection); // format result in HTML table //ifx_htmltbl_result($sql_result,"border=0"); $read = ifx_htmltbl_result($sql_result,"border=0"); // multiple recipients $to = '[email protected]' . ', '; // note the comma $to .= '[email protected]'; // subject $subject = 'Test Pending Employees'; // message $message = ifx_htmltbl_result($sql_result,"border=0").$read; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: [email protected]' . "\r\n"; $headers .= 'From: Human Resource' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); // free resources and close connection ifx_free_result($sql_result); ifx_close($connection); ?>
Sponsor our Newsletter | Privacy Policy | Terms of Service