php - How to get rid of unwanted Html and Css tags in Csv file? -
i have written code outputs table data onto csv file. in output files headings of table displayed , rest html , css tags don't want in output. code have written below:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> </head> <?php //connecting database include 'dbconn.php'; // create file pointer connected output stream $output=fopen('php://output', 'w'); $filename = 'out.csv'; // $output = fopen('demosaved.csv', 'w'); ob_end_clean(); header('content-type: application/csv'); header('content-disposition: attachement; filename="' . $filename . '"'); // output column headings fputcsv($output, array('id','first_name', 'last_name','cell_phone','email','insurance_carrier','date_created','date_last_modified','call_resolution','date_of_birth','address','city','state','zip','pain','scar','ed','herpers','shingles','metabolic','source_id')); // fetch data // $rows=mysqli_query($connect,'select id,first_name,last_name,cell_phone,date_created,date_modified,best_time_contact newform'); $rows = mysqli_query($connect,"select f.id,f.first_name,f.last_name,f.cell_phone,f.email,f.insurance_carrier,m.date_created,m.date_modified,m.call_resolution,m.d_o_b,m.address,m.city,m.state,m.zip,m.pain,m.scar,m.ed,m.herpers,m.shingles,m.metabolic, l.name `newform` f left join medication m on f.id = m.user_id left join livingdata l on f.reference_id = l.id"); //die(print_r($rows)); // loop on rows, outputting them while ($row = mysqli_fetch_assoc($rows)) { fputcsv($output,$row); } fclose($output); //exit() ?> <body> <p>new php </p> </body> </html>
Comments
Post a Comment