The following code only generates the first csv file. The second
request is just ignored. What am I doing wrong? I am using Mozilla
Firefox, Windows XP, and Xampp.
<?php
require 'bm_connect.php';
// export to csv file the table bmbookmark and call it bookmarks.csv
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=bookmarks.csv");
$query = "SELECT * FROM bmbookmark";
$result = mysql_query($query);
while($row = mysql_fetch_row($result)){
print implode(",", $row)."\n";
};
mysql_free_result($result);
exit();
// export to csv file the table bmcat and call it categories.csv
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=categories.csv");
$query = "SELECT * FROM bmcat";
$result = mysql_query($query);
while($row = mysql_fetch_row($result)){
print implode(",", $row)."\n";
};
mysql_free_result($result);
exit();
?>
Regards,
Jan Nordgreen 4 2377
While the city slept, Jan Nordgreen <ro*******@hotmail.com> feverishly
typed: The following code only generates the first csv file. The second request is just ignored. What am I doing wrong? I am using Mozilla Firefox, Windows XP, and Xampp.
<?php
require 'bm_connect.php';
// export to csv file the table bmbookmark and call it bookmarks.csv header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=bookmarks.csv"); $query = "SELECT * FROM bmbookmark"; $result = mysql_query($query); while($row = mysql_fetch_row($result)){ print implode(",", $row)."\n"; }; mysql_free_result($result); exit();
[...]
Do you really want the script to exit here? Or would you prefer it to carry
on and do the second csv file? ;-) If so, take out this first instance of
exit();
Cheers,
Nige
--
Nigel Moss.
Email address is not valid. ni***@nigenetDOG.org.uk. Take the dog out! http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy!
So that is what exit(); does! :)
When I removed the exit(); only one csv file was created.
First the first table was listed,
then this message was listed in the csv file:
<b>Warning</b>: Cannot modify header information - headers already
sent by (output started at C:\jans data\jan programs\apache php mysql
etc\xampp\htdocs\xampp\excel.php:31) in <b>C:\jans data\jan
programs\apache php mysql etc\xampp\htdocs\xampp\excel.php</b> on line
<b>37</b><br />
and another warning:
<b>Warning</b>: Cannot modify header information - headers already
sent by (output started at C:\jans data\jan programs\apache php mysql
etc\xampp\htdocs\xampp\excel.php:31) in <b>C:\jans data\jan
programs\apache php mysql etc\xampp\htdocs\xampp\excel.php</b> on line
<b>38</b><br />
then the second table was listed,
then the html code of the main php file was listed.
I wanted two csvs, not one. I don't like error messages in the csv
files. I don't like the html code listed in the csv file.
What am I doing wrong?
Regards,
Jan Nordgreen
"Jan Nordgreen" <ro*******@hotmail.com> wrote in message
news:34**************************@posting.google.c om... So that is what exit(); does! :)
When I removed the exit(); only one csv file was created.
First the first table was listed,
then this message was listed in the csv file:
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at C:\jans data\jan programs\apache php mysql etc\xampp\htdocs\xampp\excel.php:31) in <b>C:\jans data\jan programs\apache php mysql etc\xampp\htdocs\xampp\excel.php</b> on line <b>37</b><br />
and another warning:
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at C:\jans data\jan programs\apache php mysql etc\xampp\htdocs\xampp\excel.php:31) in <b>C:\jans data\jan programs\apache php mysql etc\xampp\htdocs\xampp\excel.php</b> on line <b>38</b><br />
then the second table was listed,
then the html code of the main php file was listed.
I wanted two csvs, not one. I don't like error messages in the csv files. I don't like the html code listed in the csv file.
What am I doing wrong?
Regards, Jan Nordgreen
You're trying to download two documents to the user - that's what's wrong.
You can't. Aa a suggestion, use Javascript to open a window for each
download (even if that will be ugly).
Garp
While the city slept, Jan Nordgreen <ro*******@hotmail.com> feverishly
typed: So that is what exit(); does! :)
It does exactly what it says on the tin! ;-)
When I removed the exit(); only one csv file was created.
Sorry. I didn't read your code properly. I can see what it is doing now.
As an alternative, you *could* produce a script to write the data from the
tables into two csv files on the server (see http://www.php.net/manual/en/ref.filesystem.php for some info on PHP's file
handling functions), then make a link to each file on the page, or even then
open a page that presents each of the two files in <spit>frames</spit>...
just some thoughts.
Hope that helps,
Nige
--
Nigel Moss.
Email address is not valid. ni***@nigenetDOG.org.uk. Take the dog out! http://www.nigenet.org.uk | Boycott E$$O!! http://www.stopesso.com
In the land of the blind, the one-eyed man is very, very busy! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Lenz Grimmer |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
MySQL 4.0.14, a new version of the popular Open Source/Free Software
Database, has been released. It is now available in source and binary...
|
by: Mike Chirico |
last post by:
Interesting Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Copyright (GPU Free Documentation License) 2004
Last Updated: Mon Jun 7 10:37:28 EDT 2004
The latest...
|
by: Matt Liverance |
last post by:
I REALLY dont want to switch to oracle :( but I cant get these tables
working any faster.
I've got 2 dedicated servers, each with a slave, all run 32gig 15k rpm
raid 5 on u320 perc raid...
|
by: mike vidal |
last post by:
Is it possible to restore a mysql server if all that you have is the
data files. This database uses innodb tables.
|
by: Richard Huxton |
last post by:
On Thursday 12 February 2004 20:25, Prashanthi Muthyala wrote:
> Hi Richard
Hi Prashanthi - nice to hear from you again. I've taken the liberty of cc-ing
the general list on this, since there...
|
by: jlee |
last post by:
I'm pretty much a newbie on mysql, and I need some help.
I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4
(i386) on a server hosting an active website.
The site's developer...
|
by: eieiohh |
last post by:
MySQL 3.23.49
PHP 4.3.8
Apache 2.0.51
Hi All!
Newbie..
I had a CRM Open Source application installed and running. Windows Xp
crashed. I was able to copy the contents of the entire hard...
|
by: Good Man |
last post by:
Hi there
I've noticed some very weird things happening with my current MySQL setup
on my XP Laptop, a development machine.
For a while, I have been trying to get the MySQL cache to work....
|
by: alf |
last post by:
Hi,
is it possible that due to OS crash or mysql itself crash or some e.g.
SCSI failure to lose all the data stored in the table (let's say million
of 1KB rows). In other words what is the worst...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |