Jump to content

Trisha

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Trisha's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The above code downloads the csv file.... as "export.csv".... I need help with the mail function that attaches the above downloaded file and sends to a particular email address... I've tried plenty but can't even seem to get close
  2. that's weird.. I thought I attached the code anyway, I'll paste it here again... Thanks for the response!! <?php // Connect to the database server $dbcnx = @mysql_connect("localhost", "root", ""); if (!$dbcnx) { echo( "<P>Unable to connect to the " . "database server at this time.</P>" ); exit(); } // Select database if (! @mysql_select_db("adcol") ) { echo( "<P>Unable to locate " . "database at this time.</P>" ); exit(); } // Request data $result = mysql_query( "SELECT usertype,COUNT(name) as data FROM jos_users GROUP BY usertype"); if (!$result) { echo("<P>Error performing query: " . mysql_error() . "</P>"); exit(); } $num_fields = mysql_num_fields($result); $headers = array(); $fp = fopen('php://output', 'w'); if ($fp && $result) { header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="export.csv"'); header('Pragma: no-cache'); header('Expires: 0'); fputcsv($fp, $headers); while ($row = mysql_fetch_assoc($result)) { fputcsv($fp, array_values($row)); } die; } ?>
  3. Hi, I have the program which get's the results from the database and allows download of the info in .csv format. Now I want to be able to mail this file as an attachment to an email address using gmail server. I've come up with a mail program which can mail the info from database in text format... need help in modifying it to send csv attachment. Any help is greatly appreciated. Thanks in advance!! [attachment deleted by admin]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.