<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Help wih fputcsv()  issue</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Help-wih-fputcsv-issue-82304</link>
        <description></description>
        <pubDate>Tue, 09 Jun 2026 08:28:28 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Help-wih-fputcsv-issue-82304" rel="self" type="application/rss+xml" />

                <item>
          <title>Help wih fputcsv()  issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244958#post2244958</link>
          <description><![CDATA[<p>Hi Daniel,</p>
<p>Thanks for catching that. I don't think I ever would.</p>
<p>I tried a list of &lt;?php $location=" " ?&gt; and the same ideas for all the other variables after the</p>
<p>&lt;?php foreach ($booksRecords as $record): ?&gt;</p>
<p>on line 1067</p>
<p>And that worked!</p>
<p>Thanks as always,</p>
<p>Jerry Kornbluth</p>]]></description>
          <pubDate>Wed, 05 Aug 2020 14:13:19 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244958#post2244958</guid>
        </item>
                <item>
          <title>Help wih fputcsv()  issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244957#post2244957</link>
          <description><![CDATA[<p>Hi Jerry,</p>
<p>If you check out the block of code starting around line 1479, this is where the values are being assigned to the csv row. For example:</p>
<pre class="language-php"><code>if ($location_visible) { $csvLine[] = @$location; }</code></pre>
<p>If you trace back where $location is being assigned, we find this block (lines 1081-1089):</p>
<pre class="language-php"><code>              &lt;?php if(($location_visible == 1)):?&gt;
              &lt;?php if($record['location'] ):?&gt;
              &lt;?php // Replace all commas with space and dash
					  $location = $record['location:label'];
					  $location = preg_replace("[,]", " -", $location); ?&gt;
              &lt;?php echo htmlencode($location)?&gt;,
			    &lt;?php else : ?&gt;
              ,
              &lt;?php endif ?&gt; &lt;?php endif ?&gt;</code></pre>
<p>As you can see, $location is only being assigned if the record has a location set. If the record doesn't have anything set for location, then the previously assigned value will remain unless the variable's value is explicitly reset (which it doesn't appear to be). I assume this is the case generally for the rest of the column values. You'll need to reset each of these variables at the top of the loop before they are to be assigned to make sure you're only using data relevant to the current record.</p>
<p>Let me know if this helps you out or if you have any further questions!</p>
<p>Thanks,</p>]]></description>
          <pubDate>Wed, 05 Aug 2020 11:49:26 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244957#post2244957</guid>
        </item>
                <item>
          <title>Help wih fputcsv()  issue</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2244955#post2244955</link>
          <description><![CDATA[<p>Hi All,</p>
<p>Back in January Daniel helped me with fputcsv() in this post: <a href="https://www.interactivetools.com/forum/forum-posts.php?postNum=2244435" rel="nofollow">https://www.interactivetools.com/forum/forum-posts.php?postNum=2244435</a></p>
<p>I thought everything was working fine, but I’ve come up with a small problem that I’m hoping someone can help me with.</p>
<p>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.</p>
<p>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.</p>
<p>Hope that makes sense.</p>
<p>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)</p>
<p>Appreciate it if someone could take a look.</p>
<p>Thanks,</p>
<p>Jerry Kornbluth</p>]]></description>
          <pubDate>Wed, 05 Aug 2020 05:15:24 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2244955#post2244955</guid>
        </item>
              </channel>
    </rss>
  