You are here: Re: reading a var from another file « All PHP « IT news, forums, messages
Re: reading a var from another file

Posted by Brian on 05/26/05 14:48

"Paul" <freelance@dezignage.net> wrote in message
news:Z_9le.1484742$6l.812316@pd7tw2no...
> Brian wrote:
>> This site I am working on is driving me up the F*****g wall ! , sorry
>> just needed to get
>> that of my chest
>>
>> I have site that run a MySQL query, there are many permutations of this
>> query depending
>> on what the users asks for (about 50 I think).
>>
>> I also need to save the queryed results into a CSV file and zip it on
>> the fly. I have the
>> code to do this (makezip.php), first of all I tried sending the MySQL
>> query to makezip.php
>> , this didn't work (see post Re: sending a MySQL query) so I am now
>> trying a different way.
>>
>> search.php runs the search and displays the results on the screen. It
>> also creates a var called $filedata,
>> the var is the data to be zipped up
>>
>> makezip.php has the class to make the zip file.
>>
>> what I was trying to get the following to work........
>>
>> run the search.php, this give me the var $filedata I need. Have a link on
>> this page to
>> another file called savezip.php, this links runs another page called
>> savezip.php that
>> calls the below code.
>>
>> (the code needed to exicute making a zip file)
>>
>> include("search.php");
>> include("makezip.php");
>>
>> $zipfile = new zipfile();
>> $zipfile -> add_file($filedata, "test.csv");
>> header("Content-type: application/octet-stream");
>> header("Content-disposition: attachment; filename=newtest.zip");
>> echo $zipfile -> file();
>>
>> I was hopping that when the link is clicked it run, it would read the var
>> $filedata from the search.php
>> and create the zip file for downloading, instead the savezip.php is
>> reading in and displaying
>> the search.php.
>>
>> I can't past the $filedata to save.php as its way to big, How can I get
>> round this? How can I get the
>> savezip.php to read the $filedata from search.php but without including
>> the whole script?
>>
>> Once again thanks in advance,
>>
>>
>> Brian
>>
>>
>>
> Why don't you include your zipfile.php as part of search.php? then it
> becomes one script and then you won't need to pass it anywhere... or have
> your search.php at least create the zip file.. and then all you need to
> pass is the URL of the zip file to your other file that the user can click
> on and downlaod it from there...?

The problem is that I need to change the headers when the script is called
this way a pop up window appears to download the zip file. This zip file
is done on the fly and no copies are made on the server so I can't put a
link to it (done this way so the server does not get filled up with zip
files)

Brian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация