help on creating a CSV file on the fly and sending it over to the customer
| From: | Nando2 | Date: | Sun, 03 Dec 2000 15:01:51 +0000 |
| Subject: | help on creating a CSV file on the fly and sending it over to the customer | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4979@lists.php.net to get a copy of this message | ||
Peter,
Thank you very much. Yes, I have created CSV files with other apps than PHP.
I do this often with C++ and Delphi so that I know how to do that based on a
returned query. The CSV would be created through file PHP's file access
capabilites ,which I have covered already, based on a returned query. That's
OK.
What I need to know more specificaly is this :
In order to display the available order numbers to be retrived I would do
something like a "select distinct order_number from tbl_orders order by
order_number" then I would place them on a HTML table.
In each cell of the HTML generated table I would put a check box before the
order number with a value that equals to the order number.
The problem is that I don't understand how it would work to ,after the post,
reference to what checkboxes where checked so that I could do something like
this : "select * from tbl_orders wher (order_umber = $CheckBoxValue1) and
(order_number = $CheckBoxValue2) and ... until all the selected checkboxes
values are on the SQL statement.
After the SQL statement I would create the CSV file wirting each row to it
separating the fiels with a ;.
My difficulties are :
1) How to submit the selected checkboxes to have their respective order
number included on the SQL statement. How would I name the checkboxes fields
so that I can referrence them later?
2) How to send the CSV file to the user once it is created.
Could you help me clarify that?
regards,
C.F.
----- Original Message -----
From: "Peter Bowen" <pzb@datastacks.com>
To: "Nando2" <nando@antunes.eti.br>
Cc: "php-db" <php-db@lists.php.net>
Sent: Sunday, December 03, 2000 7:33 AM
Subject: Re: [PHP-DB] help on creating a CSV file on the fly and sending it
over to the customer
Carlos:
I have written a system almost identical to the one that you specify. It
it a fairly easy to program in PHP, but you must think it through first.
You are talking about applicaton design, not simple PHP coding, and that
is something beyond the scope of this list.
In response to your second question, CSV files are easy to produce, you
just retrive the data, and write it out with a comma between each column
in the result. It is just like building an html table, but you use ","
between each cell, instead of "</td><td>", and just a CR-LF at the end of
each row, rather than "</tr><tr>".
I hope that this help.
Thanks.
Peter Bowen
On Sun, 3 Dec 2000, Nando2 wrote:
> Hello everyone,
>
> I would like to create a PHP script to do the following :
>
> It 's a order system that allows a certain user to select the orders and
have the system to write a CSV (a text file of the result query that has
fields separated by ;) and then send it over to the user through http. This
user is the one that will process the order, not the buyers who are actually
entering the orders.
>
> 1) Allow this user to select orders by clicking checkboxes. The orders
numbers would be presented as a HTML table with checkboxes. Once the user
clicks submit it would send through post the order number so that a query
could be executed to retrive all order data with the selected order numbers.
>
> 2) Once the query is triggered the system would produce a text file on CSV
format with the query result an send it over to the user through http.
>
> Has anyone ever did something like this? Can anyone help me or give me any
directions on how to achieve it?
>
> Thank you very much,
>
> Carlos Fernando.
>