title: php error Trying to get property of non-object
body: <p>I have an admission form which is getting value from database table. Scenario is I have list of courses a student select a course and I pass course ID in URL then use this code to get corresponding Course name in the field: (The form is designed in joomla using breezing forms.)</p>
  
  <pre><code>$this-&gt;execPieceByName('ff_InitLib');
  $course_id= JRequest::getVar('CID');
  global $database, $rec;
  $database-&gt;setQuery("SELECT * FROM course_list WHERE record = '$course_id' AND name = 'CourseName'");
  $row = $database-&gt;loadObjectList();
  $rec = $row[0];
  ff_setValue('ProsCourse', $rec-&gt;value);
  </code></pre>
  
  <p>Unfortunately I get this error:</p>
  
  <blockquote>
    <p><strong>* EXCEPTION CAUGHT BY FACILEFORMS *</strong>
    PHP error level : E_NOTICE
    PHP filename : /home/web10385/public_html/<strong><em>*</em>*</strong>/components/com_breezingforms/facileforms.process.php(1219) : eval()'d code
    PHP linenumber : 7
    Last known pos : Before form custom piece code at line 1
    Error message : Undefined offset: 0</p>
    
    <p><strong>* EXCEPTION CAUGHT BY FACILEFORMS *</strong>
    PHP error level : E_NOTICE
    PHP filename : /home/web10385/public_html/<strong><em>*</em>*</strong>/components/com_breezingforms/facileforms.process.php(1219) : eval()'d code
    PHP linenumber : 8
    Last known pos : Before form custom piece code at line 1
    Error message : Trying to get property of non-object</p>
  </blockquote>
  
  <p>The above code is the before form piece.</p>
  
  <p>Thanks</p>