title: encrypt the data from SQL injections
body: <p>Please tell me how to correctly encrypt the data (username, email, message) sent to the server from sql injections. I can not understand the syntax of the record itself.</p>
  
  <p>My php handler</p>
  
  <pre><code>session_start();
  
  if (isset($_SESSION['captcha']) &amp;&amp; $_SESSION['captcha']===$_POST['captcha']){
      if (isset($_POST['username']) &amp;&amp; isset($_POST['email']) &amp;&amp; isset($_POST['message'])){
  
          $username = $_POST['username'];
          $email = $_POST['email'];
          $message = $_POST['message'];
  
          $db_host = "localhost"; 
          $db_user = "alekspvn"; // Логин БД
          $db_password = "123"; // Пароль БД
          $db_table = "book"; // Имя Таблицы БД
  
      $connect_db=mysql_connect(HOST, MYSQL_USER, MYSQL_PASS)   
          or die("No connection with SQL"); 
  
          mysql_select_db("guests_db",$connect_db);
  
          mysql_query("SET NAMES 'utf8'",$connect_db);
  
          $result = mysql_query ("INSERT INTO ".$db_table." (username,email,message) VALUES ('$username','$email','$message')");
          echo json_encode(['success' =&gt; true, 'message' =&gt; 'Added to db']);
      } 
  }
  else { 
     echo json_encode(['error' =&gt; false, 'message' =&gt; 'Wrong captcha']);
  }
  </code></pre>