Object of class mysqli_result could not be converted to string in
I am executing the below code.
$result = mysqli_query($con, "SELECT classtype FROM learn_users WHERE username='abcde'");
echo "my result";
I am getting the following error:
 Object of class mysqli_result could not be converted to stringÂ
 If you are getting Catchable fatal error: Object of class mysqli_result could not be converted to string.
The mysqli_query() method will be returning an object resource to your $result variable, not a string value.
You have to loop it up and then access the records. Because you directly can not use it as your $result variable.
while ($row = $result->fetch_assoc()) {
  echo $row['classtype']."";
}