title: SELECT command denied to user ''@'localhost' for table 'tasks'
body: <p>I keep getting that error even though all the privileges have been provided to the localhost. I can insert data from same username/pass but it doesn't retrieve it. </p>
  
  <p>I have already tried the methods of commenting the lines in <strong>config.inc.php</strong> and executing <strong>GRANT</strong>.</p>
  
  <p>Here's my code below</p>
  
  <pre><code>&lt;?php
          $servername = "localhost";
          $username = "root";
          $password = "";
          $dbname = "to_do_list";
  
          // Create connection
          $conn = new mysqli($servername, $username, $password, $dbname);
          // Check connection
          if ($conn-&gt;connect_error) {
              die("Connection failed: " . $conn-&gt;connect_error);
          } 
  
          $query = "SELECT `task`, `date_of_task`, `time_of_task`,`id`  FROM `to_do_list`.`tasks`;"; 
  
         $result = mysql_query($query) or die($query."&lt;br/&gt;&lt;br/&gt;".mysql_error());
  
  
        while($row = mysql_fetch_array($result)){         
          echo "&lt;tr&gt;".
          "&lt;td&gt;" . $row['task'] . "&lt;/td&gt;".
          "&lt;td&gt;" . $row['date_of_task'] . "&lt;/td&gt;".
          "&lt;td&gt;" . $row['time_of_task'] . "&lt;/td&gt;".
          "&lt;td&gt; &lt;button value=\"Edit\" class=\"btn btn-warning\"&gt; &lt;/td&gt;".
          "&lt;td&gt; &lt;button value=\"Edit\" class=\"btn btn-warning\"&gt; &lt;/td&gt;".
          "&lt;/tr&gt;";  
          }
          mysql_close();
      ?&gt;
  </code></pre>
  
  <p>Thanks.</p>