<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Empty Record Errors</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Empty-Record-Errors-82648</link>
        <description></description>
        <pubDate>Fri, 10 Apr 2026 10:19:58 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Empty-Record-Errors-82648" rel="self" type="application/rss+xml" />

                <item>
          <title>Empty Record Errors</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2246449#post2246449</link>
          <description><![CDATA[<p>Hi Rez, </p>
<p>If there's no record then the $about_usRecord will be undefined, so you'll get errors.  </p>
<p>Normally, the code generator will display a die statement to check if the record isn't defined.</p>
<pre class="language-php"><code>$about_usRecord = @$about_usRecords[0]; // get first record
if (!$about_usRecord ) { dieWith404("Record not found!"); } // show error message if no record found</code></pre>
<p>So that's one option, or you can wrap the code you don't want displayed in an if block like you did, or you can add @ in front of the variables you don't want to display errors when they're undefined.</p>
<p>Hope that helps!  Let me know any questions.</p>]]></description>
          <pubDate>Fri, 24 Feb 2023 19:39:00 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2246449#post2246449</guid>
        </item>
                <item>
          <title>Empty Record Errors</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2246446#post2246446</link>
          <description><![CDATA[<p>Actually, the code generator doesn't use if statements. My memory is bad, but I thought so!</p>
<p>OK, why am I getting this error everywhere for empty records then?</p>
<pre class="language-markup"><code>Notice: Trying to access array offset on value of type null in /home2/website/public_html/index.php on line 149

  list($about_usRecords, $about_usMetaData) = getRecords(array(
    'tableName'   =&gt; 'about_us',
    'where'       =&gt; '', // load first record
    'loadUploads' =&gt; true,
    'allowSearch' =&gt; false,
    'limit'       =&gt; '1',
  ));
  $about_usRecord = @$about_usRecords[0]; // get first record



    &lt;section class="theme-b"&gt;
      &lt;div class="grid-container"&gt;		
        &lt;div class="grid-x grid-padding-x text-center align-center-middle"&gt;
          &lt;div class="cell medium-8 padding-vertical-2"&gt;
              &lt;h2&gt;&lt;?php echo $about_usRecord['title']; ?&gt;&lt;/h2&gt;
              &lt;?php echo $about_usRecord['content']; ?&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/section&gt;</code></pre>
<p>?</p>]]></description>
          <pubDate>Mon, 20 Feb 2023 19:48:18 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2246446#post2246446</guid>
        </item>
                <item>
          <title>Empty Record Errors</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2246443#post2246443</link>
          <description><![CDATA[<p><span>For a single record section, I just included an if statement in the body and removed the default "record not found" error in the list code. This allows pages to skip empty record sections without error. It works fine, however, in the past, there was no need for an if statement and no errors appeared. Was there a different default list code? I thought I used to simply add </span><span>&lt;?php echo $about_usRecord['content']; ?&gt;</span><span> wherever I needed it on a single record page.</span></p>
<p><span>Am I wrong? I guess I must be. It's odd that an error should be thrown from a CMS on a website because a record is empty (no content).</span></p>
<pre class="language-markup"><code>  list($about_usRecords, $about_usMetaData) = getRecords(array(
    'tableName'   =&gt; 'about_us',
    'where'       =&gt; '', // load first record
    'loadUploads' =&gt; true,
    'allowSearch' =&gt; false,
    'limit'       =&gt; '1',
  ));
  $about_usRecord = @$about_usRecords[0]; // get first record


    &lt;?php if($about_usRecord):?&gt; // I don't recall this if check being required      
              &lt;?php echo $about_usRecord['content']; ?&gt;
    &lt;?php endif?&gt;</code></pre>]]></description>
          <pubDate>Mon, 20 Feb 2023 15:02:49 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2246443#post2246443</guid>
        </item>
              </channel>
    </rss>
  