错误:mysqli_fetch_object()期望参数1为mysqli_result

I don't know what the problem is with this line or how to fix it, before was okay and now I'm getting this error:

mysqli_fetch_object() expects parameter 1 to be mysqli_result

Here is my PHP code:

<?php
}   
if($_GET['action']=="user_info")
    {

    $userid = $_GET['user_id'];

    $query = "SELECT * FROM user WHERE user_id ='{$userid}'";
    $result = mysqli_query($link, $query);
    $user = mysqli_fetch_object($result);

    $queryt = "SELECT * FROM user_title WHERE id='".$user->title."'";
    $resultt = mysqli_query($link, $queryt);
    $rowt = mysqli_fetch_object($resultt);
    $title = $rowt->name;

        $sorgu = "select * from pub_author where user_id='$userid'";
        $publications = mysqli_query($link, $sorgu);

        while($a = mysqli_fetch_object($publications))
    {
       $ids .= $a->pub_id . ',';
    }

       $ids = rtrim($ids,",");
   $sorgu2 = "select count(id) as total , year from publication where id IN ($ids)
       GROUP BY YEAR(`year`) order by `year` ";
   $publications2 = mysqli_query($link, $sorgu2);

       while($a2 = mysqli_fetch_object($publications2))
       {
          $mount = explode('-', $a2->year);
          $accyaz[$mount[0]] = $a2->total;
      }
  }

?>

As far as your exact error is concerned one of your query is failing, the following steps might help. Ofcourse you question looks duplicate but here are some of the things that addresses your question

Your first query should be like this, with no curly braces, ofcourse untill you have explicitly ids wrapped in curly braces in your table.

SELECT * FROM user WHERE user_id ='$userid'

Secondly you are executing multiple queries so you might wanna consider error checking if your query executes properly or not(because of syntax error columns mismatch table name mismatch many more possibilities): do error checking like this as for while($a...) part

if ($result=mysqli_query($link, $sorgu);)
{
  while($a=mysqli_fetch_object($result))
  {
    $ids .= $a->pub_id . ',';
  }

  $sorgu2 = "select count(id) as total , year from publication where id IN ($ids) GROUP BY YEAR(`year`) order by `year` ";

  //... Your further code
}
else
{
    echo "Something went wrong while executing query :: $sorgu";
}

Third i see your are getting pub_id make a comma seperated list of it so that you can give it as a parameter in your last query which is a long shot, why not use sub query for you IN clause like this:

SELECT 
    COUNT(id) as total, year 
    FROM publication 
    where id 
    IN (
        SELECT pub_id FROM pub_author WHERE user_id='$userid'
    ) 
    GROUP BY `year`
    order by `year`;

The error you are stating translates to this: The query fails somehow, instead of running the mysqli_query($link, $sorgu); line echo $sorgu, go to phpmyadmin and test your query, if it is bad, fix it in phpmyadmin until it works and set it up in the code correctly