Help wih fputcsv() issue

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 5, 2020   (RSS)

Hi All,

Back in January Daniel helped me with fputcsv() in this post: https://www.interactivetools.com/forum/forum-posts.php?postNum=2244435

I thought everything was working fine, but I’ve come up with a small problem that I’m hoping someone can help me with.

Up to now, when there was a pull down list field in a record in my table, there was always a value selected, and each row in the downloaded csv displayed its appropriate value.

I was asked to add some new pull down list fields, and I’ve discovered that unless a value is chosen for a particular record, the value from the last record with a value selected is repeated in each row in the resulting csv until a new value is encountered. The search results output does not show the same issue.

Hope that makes sense.

I’ve attached a screen shot of a sample search result output, the corresponding csv result and the complete viewer code. (the fputcsv code begins after line 1023)

Appreciate it if someone could take a look.

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Attachments:

Search result.jpg 70K

csv.jpg 86K

spreadC.php 69K

By gkornbluth - August 5, 2020 - edited: August 5, 2020

Hi Daniel,

Thanks for catching that. I don't think I ever would.

I tried a list of <?php $location=" " ?> and the same ideas for all the other variables after the

<?php foreach ($booksRecords as $record): ?>

on line 1067

And that worked!

Thanks as always,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php