Jump to content

[SOLVED] PHP Excel output problem


sayedsohail

Recommended Posts

Hi,

I am having a small problem somewhere in my script, as the output of my php produce an excel sheet but all the columns is having a < d> tag.  I don't know here i went wrong.  Please help.

Here is my script:


[code]<?php
$recNum = $_GET['rec_No'];

$select = "SELECT * FROM clients where id=$recNum";
$export = mysql_query($select);
$fields = mysql_num_fields($export);
$header = "<table border=1><tr>";
for ($i = 0; $i < $fields; $i++) {
$header .= "<td>".mysql_field_name($export, $i) . "<\td>";
}
$header .= "</tr>";
while($row = mysql_fetch_row($export)) {
$line = "<tr>";
foreach($row as $value) {
if ((!isset($value)) OR ($value == "")) {
$value = "<td>&nbsp;</td>";
} else {
$value = str_replace('"', '""', $value);
$value = "<td>" . $value . "<\td>";
}
$line .= $value;
}
$data .= trim($line)."</tr>";
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/35881-solved-php-excel-output-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.