title: How to fix the Warning mysqli_select_db()
body: <p>i was created the <code>connection.php</code> file and written the code in it:
  here is the code:-</p>
  
  <pre><code>&lt;?php
  $connection=mysqli_connect("localhost","root","");
  if($connection)
  {
      echo "database  connected: ";
  }
  ?&gt;
  </code></pre>
  
  <p>and now after doing that i created another file <code>form.php</code> and written the code in it:
  here is the code:-</p>
  
  <pre><code>&lt;?php
  require_once("connection.php");
  if($_POST['submit'])
  {
      $fn=$_POST['fname'];
      $ln=$_POST['lname'];
      mysqli_select_db("class",$connection);
      $query="INSERT INTO student(id,firstname,lastname) VALUES('','$fn','$ln')";
      if(mysqli_query($query,$connection))
      {
          echo "inserted sucessfully:";
      }
      else
      {
          echo " error occured";
      }
  }
  ?&gt;
  </code></pre>
  
  <p>problem is that i got an  error on line 7.here is an error:-</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to undefined function
    mysql_select_db()in F:\wamp\www\MyphpPages\form.php on line 7</p>
    
    <p>( ! ) Error: Call to undefined function mysql_select_db() in
    F:\wamp\www\MyphpPages\form.php on line 7</p>
  </blockquote>
  
  <p>i tried to replace <code>mysql_select_db</code> to <code>mysqli_select_db</code> but when i do this the error occurred:-</p>
  
  <blockquote>
    <p>Warning: mysqli_select_db() expects parameter 1 to be mysqli, string
    given  in  on line 7</p>
  </blockquote>
  
  <p>my motive is to inserted the data into the form and save into the mysql database 
  but cannot plz help me?</p>