title: Warning: mysqli_error() expects parameter 1 to be mysqli, string given in
body: <p>I want to connect to a database (with xampp) called ranch and insert into this db some form data. The browser displays the error:</p>
  <blockquote>
  <p>Warning: mysqli_error() expects parameter 1 to be mysqli, string given
  in C:\xampp\htdocs\project1\register.php on line 38</p>
  <p>ERROR: Could not able to execute INSERT INTO
  child_parent('childname','childsurname','age','gender','name','surname','address','tk','city','telephone','mobile','email','parea','pass')
  VALUES('nikos','ads','34','Αγόρι','sds','sds','dsd','34','dsds','34','434','mail@hotmail.com','sds','34').</p>
  </blockquote>
  <p>I have the .php file that is below.
  How can I fix it?</p>
  <pre><code>&lt;?php
  
  ini_set('display_errors', 'On');
  session_start();
  unset ($msg);
      echo &quot;kajsj&lt;br&gt;&quot;;
      $conn= new mysqli(&quot;localhost&quot;,&quot;root&quot;,&quot;&quot;,&quot;ranch&quot;);
      
      if (mysqli_connect_errno())
      { printf(&quot;Connect failed: %s\n&quot;,mysqli_connect_error());//error message
      }
      else
      {
      printf(&quot;Connect achieved&lt;br&gt;&quot;); 
      echo $_GET['childname'];
      $childname=$_GET['childname'];
      $childsurname=$_GET['childsurname'];
      $age=$_GET['age'];
      $gender=$_GET['gender'];
      $name=$_GET['name'];
      $surname=$_GET['surname'];
      $address=$_GET['address'];
      $tk=$_GET['tk'];
      $city=$_GET['city'];
      $telephone=$_GET['telephone'];
      $mobile=$_GET['mobile'];
      $email=$_GET['email'];
      $parea=$_GET['parea'];
      $pass=$_GET['pass'];
      // Insert data into mysql 
      $query1=&quot;INSERT INTO child_parent('childname','childsurname','age','gender','name','surname','address','tk','city','telephone','mobile','email','parea','pass')
                                  VALUES('$childname','$childsurname','$age','$gender','$name','$surname','$address','$tk','$city','$telephone','$mobile','$email','$parea','$pass')&quot;;
      
      if(mysqli_query($conn, $query1))
      {echo &quot;Records added successfully.&quot;;
      } 
      else{echo &quot;ERROR: Could not able to execute $query1. &quot; . mysqli_error($query1);
      }
      }
  ?&gt;
  </code></pre>