title: Defining declared variable outside of my class
body: <p>I have a class where I first do a SQL check to see if some certain data exist and if not then I INSERT a new record.</p>
  
  <p>I'd like to somehow define a variable ($feedback) indicating ive either inserted something or havent - I want to use this var in a callback in my main PHP file (where ive included the class)</p>
  
  <p><strong>My class</strong></p>
  
  <pre><code>class registerVote {
  
  function registerVote(){
  
  }
  
  function init() {
      //Define some vars  
      return true;
  }
  
  function save() {
          //Sql count query
          $res = mysql_query($sql) or die( mysql_error());
          $count = mysql_result($res, 0); 
  
          //If no records are found then INSERT
          if($count &lt; 1){
              //Some INSERT query
              $feedback = "new";
          } else {
              $feedback = "old";
          }
  
      if($res) {
          return $feedback;
      }
  }
  
  }
  </code></pre>
  
  <p>My PHP FILE:</p>
  
  <pre><code>include_once ('../class/class_vote.php');
  $registerVote = new registerVote();
  
      if($registerVote-&gt;init()) {
          if($registerVote-&gt;save()) {
              //Print out my $feedback from the class
          if ($feedback == "new") {
              echo "new";
          } else {
              echo "old";
          }
          }
      }
  </code></pre>
  
  <p>The above naturally doesnt work - so im naturally wondering if im able to achieve what ive tried to illustrate?</p>