close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

PHP export tool for xls, csv and xml

Thread began 9/25/2018 2:56 am by Mike | Last modified 6/30/2022 9:59 am by Ray Borduin | 1664 views | 16 replies |

Mike

PHP export tool for xls, csv and xml

Hello,
I'm searching about an extension/script that allow me to export recordset from database in xls (excel), csv and xml.
DataBridge offers this functionality (or as a separate extension)?

In attachment an example from an old extension used several years ago (not more compatible with MySQLi).

Thanks.

Sign in to reply to this post

Ray BorduinWebAssist

You could use MySQLi Server Behaviors to create a comma separated repeated region for your data. Then just add the necessary headers to have the file downloaded and saved as a CSV like:

php:
header('Content-Type: application/octet-stream');

header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=yourfileneame.csv');
Sign in to reply to this post
Did this help? Tips are appreciated...

Mike

Ok thanks!

Sign in to reply to this post

Sweens

Hi Ray

Do you have a sample file available that I could use as a starting point?

Many thanks

Chris

Sign in to reply to this post

Ray BorduinWebAssist

I don't, but it should be very simple to do.

Give it a try and upload a copy of your page if you get stuck and I can try to help.

Sign in to reply to this post
Did this help? Tips are appreciated...

Sweens

Thanks, Ray - will do.

Sign in to reply to this post

Sweens

This post has been deleted.

Sweens

This post has been deleted.

Sweens

Hi Ray

Done it!

(I've deleted previous posts with non-working solutions)

The only thing I haven't managed is to get the fm_title from the recordset as the name of the csv file.

Latest code in the private message.

Cheers

Chris

Sign in to reply to this post

Ray BorduinWebAssist

The name of the CSV is set on this line:
header('Content-Disposition: attachment; filename=myform.csv');

So you can move the header setting below the recordset and get that value from the recordset like:
header('Content-Disposition: attachment; filename=' .$rows->getColumnVal("fm_title"). '.csv');

Sign in to reply to this post
Did this help? Tips are appreciated...
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...