title: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in json
body: <p>i got an error in my json codelike this,.</p>
  
  <p>ERROR:</p>
  
  <p>Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in D:\XAMPP\xampp\htdocs\ROOPA\music\demo.php on line 15
  {"result":null} </p>
  
  <p>PHP FILE:</p>
  
  <pre><code>&lt;?php
  
   @include("db.php");
  
  
    $query = "SELECT a.a_name as name,b.total_value as value,b.total_votes as votes,a.a_pic as image FROM _album a inner join ratings b on b.a_id=a.id"; 
  
    $result = mysql_query($query);
  
  //  $query1 = "SELECT total_value,total_votes FROM ratings";
  
    //$result1 = mysql_query($query1);
  
    $count = mysql_num_rows($result);
      //$count1 = mysql_num_rows($result1);
  
     if($count &gt; 0)
      {
  
          while($data = mysql_fetch_object($result))
           {
                $alb_name =$data-&gt;name; 
  
                $rate_value = $data-&gt;value;
  
                $rate_votes = $data-&gt;votes;
  
                $alb_pic =$data-&gt;image; 
  
                $resmsg[] = array("Album_name"=&gt;$alb_name,"Rating_total_value"=&gt;$rate_value,"Rating_total_votes"=&gt;$rate_votes,"Image_name"=&gt;$alb_pic);
  
           }
  
          $jsonarr = array("result"=&gt;$resmsg);
      }
      else
      {
          $jsonarr = array("result"=&gt;"data not found");
      }
  
   echo json_encode($jsonarr);
  
  ?&gt;  
  </code></pre>
  
  <p>MY DB.PHP FILE:</p>
  
  <pre><code>&lt;?php
  
  $hostname="localhost";
  $username="root";
  $password="";
  $database="musicalbum";
  
  $conn=mysql_connect($hostname,$username,$password,$database);
  $link=mysql_select_db($database,$conn);
  
  if (!$link) {
      die('Could not connect: ' . mysql_error());
  }
  @mysql_close($link);
  
  ?&gt;
  </code></pre>
  
  <p>CAN ANYONE HELP ME?</p>