close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Commas in recordset break CSV

Thread began 12/09/2020 2:29 pm by LionsMane | Last modified 12/09/2020 5:18 pm by Ray Borduin | 89 views | 2 replies |


Commas in recordset break CSV

I'm pulling a recordset using this Behavior, and two of the columns have text content that sometimes have a comma in them. I have a PHP script outputting this to a CSV file, and any record with a comma in one of these columns breaks out that content into multiple columns in the CSV. What do I need to do to have the process ignore the commas???

Sign in to reply to this post


code below


Sign in to reply to this post

Ray BorduinWebAssist

Try this for outputting to a CSV:


= new WA_MySQLi_RS("Recordset1",$BHSmySQL_i,0);
$Recordset1->setQuery("SELECT * FROM `extract`");
// set headers to force download on csv format
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=extract.csv');

$out fopen('php://output''w');
// we initialize the output with the headers
fputcsv($out, array('playlist_name','pid','sid','contestant_name','performance_song_title','category','username','score','comments'));

// select all members
while (!$Recordset1->atEnd()) {
// add new row
fputcsv($out, array($Recordset1->getColumnVal('playlist_name'),$Recordset1->getColumnVal('pid'),$Recordset1->getColumnVal('sid'),$Recordset1->getColumnVal('contestant_name'),$Recordset1->getColumnVal('performance_song_title'),$Recordset1->getColumnVal('category'),$Recordset1->getColumnVal('username'),$Recordset1->getColumnVal('score'),$Recordset1->getColumnVal('comments')));

// export the output
Sign in to reply to this post
Did this help? Tips are appreciated...

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





Ease of use


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...