title: How to insert data to columns from PHP into MariaDB?
body: <p>I am familiar with MySql databases but there is this new database called MariaDB. I try to insert data there from PHP code and I can't, so can you help me insert the data?  My PHP on the server is 5.4.32 and my MySQL version is 10.0.20-MariaDB-cll-live.</p>
  
  <p>This is the code that I am using to try to insert data into MariaDB.</p>
  
  <pre><code>$connection = mysql_connect("localhost", "root", ""); // Establishing Connection with Server
  $db = mysql_select_db("database", $connection); // Selecting Database from Server
  
  if(isset($_POST['submit'])){ // Fetching variables of the form which travels in URL
      $name = $_POST['name'];
      $email = $_POST['email'];
      if($name !=''||$email !=''){
         //Insert Query of SQL
         $query = mysql_query("insert into VIP Membership(Name, Email) values ('$name', '$email')");
         echo "&lt;br/&gt;&lt;br/&gt;&lt;span&gt;Data Inserted successfully...!!&lt;/span&gt;";
      }
      else{
         echo "&lt;p&gt;Insertion Failed &lt;br/&gt; Some Fields are Blank....!!&lt;/p&gt;";
      }
  }
  
  mysql_close($connection); // Closing Connection with Server
  </code></pre>
  
  <p>EDIT: I used the mysqli code now but it throws me an error 500.</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "username";
  $password = "";
  $dbname = "db_table";
  
  // Create connection
  $conn = mysqli_connect($servername, $username, $password, $dbname);
  // Check connection
  if (!$conn) {
      die("Connection failed: " . mysqli_connect_error());
  }
  if(isset($_POST['submit'])){ // Fetching variables of the form which travels in URL
  $name = $_POST['name'];
  $email = $_POST['email'];
  if($name !=''||$email !=''){
  
  $sql = "INSERT INTO 'VIP Membership' (Name, Email)
  VALUES ('$name', '$email')";
  
  if(mysqli_query($conn, $sql)) {
      echo "New record created successfully";
  } else {
      echo "Error: " . $sql . "&lt;br&gt;" . mysqli_error($conn);
  }
  }
  
  mysqli_close($conn);
  </code></pre>