title: SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your
body: <p>i have problem with my site.
  i want to create a page in php.
  in this page i want user invite user.
  but i have a error.
  i dont know what to do.
  thx all .</p>
  
  <p>the error:
  SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1..</p>
  
  <p>and in the header have a connect database.
  its not my problem.</p>
  
  <p>my code:</p>
  
  <pre><code>&lt;?php
  include('header.php');
  $n1 = rand(1, 9);
  $n2 = rand(1, 9);
  
  if(isset($_POST['send'])) {
      $nr1 = base64_decode($_POST['nr1']);
      $nr2 = base64_decode($_POST['nr2']);
      $emailinvite = $db-&gt;EscapeString($_POST['email']);
      $rec = $db-&gt;FetchArray($db-&gt;Query("SELECT id,login FROM `users` WHERE `login`='".$data['login']."'"));
  
      if($nr1 + $nr2 != $_POST['captcha']){
          $mesaj = '&lt;div class="error"&gt;pliz try again.&lt;/div&gt;';
      }elseif($_POST['email'] == ""){
          $mesaj = '&lt;div class="error"&gt;empty email&lt;/div&gt;';
      }elseif ($db-&gt;GetNumRows($db-&gt;Query("SELECT id FROM `users` WHERE `email`='".$emailinvite."'")) &gt; 0) {
          $mesaj = '&lt;div class="error"&gt;your friend register!&lt;/div&gt;';
      }else{
          $newhash = rand(1000000,9999999);
          $db-&gt;Query("INSERT INTO `inviteuser` (user,emailinvite,hash) values('".$data['login']."','".$emailinvite."','".$newhash."'");
  
              $error = 0;
  
          $subject ="invite to site";
          $message="hello
  
  the user {$rec['login']} want to invite you to :
  http://www.like2hits.net
  
  click here: 
  {$site['site_url']}/register.php?hash={$newhash}
  
  thx!";
          $header="{$site['site_email']} &lt;{$site['site_email']}&gt;";
          $send_contact=mail($emailinvite,$subject,$message,$header);
          $mesaj = "&lt;div class=\"success\"&gt;thx you!&lt;/div&gt;";
      }
  }?&gt;
  &lt;div id="login"&gt;
              &lt;div class="top"&gt;
                    &lt;h1&gt;invite friend&lt;/h1&gt;
              &lt;/div&gt;
              &lt;div class="content"&gt;&lt;div class="msg"&gt;&lt;?echo $mesaj;?&gt;&lt;/div&gt;
              &lt;form id="form" method="post"&gt;
                  &lt;input type="hidden" name="nr1" value="&lt;? echo base64_encode($n1); ?&gt;" /&gt;
                  &lt;input type="hidden" name="nr2" value="&lt;? echo base64_encode($n2); ?&gt;" /&gt;
                  &lt;fieldset&gt;
  
                          &lt;label&gt;email of your friend&lt;/label&gt;
                      &lt;p&gt;&lt;span class="fontawesome-user"&gt;&lt;/span&gt;
                          &lt;input name="email" type="email" value="" required="required" /&gt;
                      &lt;/p&gt;
  
                          &lt;label&gt;&lt;?=($n1." + ".$n2." = ?")?&gt;&lt;/label&gt;
                      &lt;p&gt;&lt;span class="fontawesome-user"&gt;&lt;/span&gt;
                          &lt;input name="captcha" type="text" value="" required="required" /&gt;
                      &lt;/p&gt;
                      &lt;p style="text-align: center; padding-top: 15px;"&gt;
                      &lt;input type="submit" name="send" value="invite user" /&gt;
                      &lt;/p&gt;
                  &lt;/fieldset&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;?
  include('footer.php');?&gt;
  </code></pre>