title: undefined variable multiple errors
body: <p>I am currently developing a website and I keep getting 2 errors in my register page. These are the errors:</p>
  
  <pre><code>Notice: Undefined variable: error in C:\xampp\htdocs\olympus\register.php on line 35
  
  Notice: Undefined variable: message in C:\xampp\htdocs\olympus\register.php on line 36
  </code></pre>
  
  <p>And these are the code lines they refer to:</p>
  
  <pre><code>line 35 - $smarty-&gt;assign('error',$error);
  
  line 36 - $smarty-&gt;assign('message',$message);
  </code></pre>
  
  <p>I've double checked everything and I can't find why I have those errors.
  Can someone help me with these one, please?</p>
  
  <p>Edit: this is the complete register.php file so far.</p>
  
  <pre><code>&lt;?php
  
  require_once 'smarty.php';
  
  if($_POST) {
      $password = $_POST['password'];
      $confirm = $_POST['confirm'];
      if($password != $confirm) {
          $error = 'Passwords do not match!'; 
      } else {
          require_once 'config.php';      // our database settings
          $conn = mysql_connect($dbhost,$dbuser,$dbpass)
              or die('Error connecting to mysql');
          mysql_select_db($dbname);
          $query = sprintf("SELECT COUNT(id) FROM users WHERE UPPER(username) = UPPER('%s')",
              mysql_real_escape_string($_POST['username']));
          $result = mysql_query($query);
          list($count) = mysql_fetch_row($result);
          if($count &gt;= 1) { 
              $error = 'that username is taken.';
          } else {
              $query = sprintf("INSERT INTO users(username,password) VALUES ('%s','%s')",
                  mysql_real_escape_string($_POST['username']),
                  mysql_real_escape_string(md5($password)));
              mysql_query($query);            
              $userID = mysql_insert_id($conn);
              require_once 'stats.php';
              setStat('atk',$userID,'5');
              setStat('def',$userID,'5');         
              setStat('mag',$userID,'5');
              $message = 'Congratulations, you registered successfully!';
          }
      }   
  }
  $smarty-&gt;assign('error',$error);
  $smarty-&gt;assign('message',$message);
  $smarty-&gt;display('register.tpl');
  
  ?&gt;
  </code></pre>