title: PHP/SQL - Object of class mysqli_result could not be converted to string
body: <p>I am fairly new to web programming but I know quite a bit. I am making a private messaging system but I am getting an error:</p>
  
  <pre><code>Catchable fatal error: Object of class mysqli_result could not be converted to string in C:\xampp\htdocs\message\send.php on line 26
  </code></pre>
  
  <p>This is the code:</p>
  
  <pre><code>$check_conv=mysqli_query($con,"SELECT `hash` FROM `message_g` WHERE (`user_one`='$my_id' AND `user_two`='$user') OR (`user_one`='$user' AND `user_two`='$my_id')");
  </code></pre>
  
  <p>What am I doing wrong, I have checked and there are values in the database. Also I have checked and I am using mysqli all around and not mixing mysql and mysqli. Any help would be greatly appreciated. Thanks.</p>
  
  <p>Edit: Full code below:</p>
  
  <pre><code>&lt;?php 
  if(isset($_POST['submit'])){
  $myusername=$_SESSION['myusername'];
  $random=rand();
  $my_id=mysqli_query($con,"SELECT `id` FROM `users` WHERE (`username`='$myusername')");
  $user=$_GET['user'];
  $check_conv=mysqli_query($con,"SELECT `hash` FROM `message_g` WHERE (`user_one`='$my_id' AND `user_two`='$user') OR (`user_one`='$user' AND `user_two`='$my_id')");
  if(mysqli_num_rows($check_conv) == 1){
      echo "&lt;p&gt;Conversation Already Started!&lt;/p&gt;";
  } else {
      mysqli_query("INSERT INTO `message_g` (`user_one`, `user_two`, `hash`) VALUES ('$my_id','$user','$random')");
      echo "&lt;p&gt;Conversation Started!&lt;/p&gt;";
      }
  }
  ?&gt;
  </code></pre>