I don't think this is a database/MySQL question - it's more to do with implementing the strip_tags function...
I have some code that takes selected fields from a MySQL database, and downloads them to a CSV file.
The trouble is that one of the fields is html, and I want to strip that field of its html with the strip_tags function before it gets to the download stage.
But I can't work out where in the code I should implement the strip_tags function (it's "field2" that I want to de-html-ize with strip_tags):
Here's the code:
// Database Connection
include 'dbconnect.php';
$query = "SELECT field1, field2, field3, field4, field5, field6 FROM mytable";
$result = mysql_query($query) or die('Error, query failed');
$tsv = array();
$html = array();
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
$tsv[] = implode("\t", $row);
$html[] = "<tr><td>" .implode("</td><td>",$row)."</td></tr>";
}
$tsv = implode("\r\n",$tsv);
$html = "<table>".implode("\r\n",$html)."</table>";
mysql_close();
$Datestamp = date("dmY");
$fileName = 'productdb'.$Datestamp.'.xls';
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$fileName");
echo $tsv;