Forum Search:
phpHtmlLib
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » General » HTML & Javascript » saving results to a file
saving results to a file Thu, 18 March 2004 11:07 Go to next message
thozi
Messages: 36
Registered: February 2004
Member

From: 175.132.3
It seems that this forum is never been used. Well I start with it. I'm a newbie in Web programming and I have a very simple task but don't know how to code that.

I want to add a "Save As" button on my Web page form, which either allows the user to enter a filename or using a file browser to select a file and location.

Actually, just the same mechanism you get when you right-click on a hyperlink and select save as.
How could I do that either by displaying a hyperlink or adding a button.

Related to PHL, I want to be able to save the datalist results into a CSV file. And I will use the adodb methods available. I can get the query results in a file without a problem, but I now would like to be able to specify the filename.

The following code fragment shows the way to do it with a fix file name:

// First let's get the mysql query and save it in $query_noLIMIT
$adodblist->data_prefetch();
$query_noLIMIT = $adodblist->_datasource->build_query();
// Now execute the query using ADODB CacheExecute or Execute
$rs = $cpd->CacheExecute($query_noLIMIT);
$path = "C:/test.csv";

// open the file
$fp = fopen($path, "w");
// call ADODBs write to csvfile method.
if ($fp) { rs2csvfile($rs, $fp);
fclose($fp);}
Re: saving results to a file Fri, 19 March 2004 09:58 Go to previous message
phphtmllib  is currently offline phphtmllib
Messages: 776
Registered: September 2002
Location: Cool, CA
Senior Member
Administrator

From: irc.sh.nu
As for your first question, I'm not really sure, other then having the saveas button submit the form, then having the php script output the file in the format you want and then setting the content type in the header to something that will force the browser to try and save it to disk.
Next Topic:js menu widget?
Goto Forum:
  


Current Time: Sat May 25 08:51:58 PDT 2013

Total time taken to generate the page: 0.24989 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.0.
Copyright ©2001-2009 FUDforum Bulletin Board Software