Hi,
I got my data to open up in excel using the script in the following as under
php Code:
Original
- php Code |
|
|
|
-
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=abc.xls>");
include("protect.php");
or
die ("Unable to connect to server.");
or
die ("Unable to select database.");
$sql = "SELECT * FROM abc ";
and so on and so forth...
Now I have some questions and request guidance:
Since this is just raw data - how do I filter the data so i get only acertain field from the table.
Example:
php Code:
Original
- php Code |
|
|
|
$sql1 = "SELECT name FROM abc WHERE id=$id";
isnt working because i dont know where to define $id. If i put it above or below the headers, i get a parse error. Foll is the script i am using to define $id.
php Code:
Original
- php Code |
|
|
|
or
die ("Unable to connect to server.");
or
die ("Unable to select database.");
$sql2 = "SELECT * FROM new ";
$id = myrow2["ID"];
2)If I dont want the data to be outputted to an excel file but just in a nice html format (changing file name above to abc.html didnt help )which looks like excel then how do I get to define fonts, colours and wrap text for this data ?
3) I have a file called contact.xls which i uploaded to my site as contact.html. I created form boxes to input data for name, address etc.
Now is there a way my output can also come out in contact.xls design ?
Thank you for reading this post and for any advise you might have.
Swati