title: How to hide SQL statements from hackers?
body: <p>I want to hide my DB connection details from hackers when they view source code 
  as they can send malicious code to my DB.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;?php
  $con=mysqli_connect("example.com","peter","abc123","my_db");
  // Check connection
  if (mysqli_connect_errno())
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  
  mysqli_query($con,"INSERT INTO Persons (FirstName, LastName, Age)
  VALUES ('Peter', 'Griffin',35)");
  
  mysqli_query($con,"INSERT INTO Persons (FirstName, LastName, Age) 
  VALUES ('Glenn', 'Quagmire',33)");
  
  mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>The hacker now knows what the user and password and name of my database is and he can inject my DB with bad code. I searched the site but couldn't find the right format to address my question.</p>