title: Why does my mysqli_query return false?
body: <p>I realise there are a lot of questions like this here, but none of them seem to help me. The problem is as follows:</p>
  
  <p>I have a website with an SQL Database, and now I am developing an application that reads the data. I've read that the best way to do that is a web service, so I'm in the process of writing one now. First, I'm trying to get all the data to display on a webpage, for testing purposes. I have the following code now:</p>
  
  <pre><code>&lt;?php
  $servername = "localhost";
  $username = "myusername";
  $password = "mypassword";
  $db = "mydatabase";
  
  // Create connection
  $conn = new mysqli($servername, $username, $password, $db, 3306);
  
  // Check connection
  if (!$conn){echo "Not connected";} else {echo "connected";}
  
  $query = "SHOW TABLES FROM mydata";
  $result = mysqli_query($query) or die(" but not executed" . mysqli_error());
  ?&gt; 
  </code></pre>
  
  <p>When I save this and go to mywebsite/test.php, it displays the following:</p>
  
  <p>connected but not executed. That means that it connects right, but the mysqli_query() returns false. However, mysqli_error is empty.</p>
  
  <p>This is the entire test.php file. Am I missing something?</p>