title: How to use mysqli_query() in PHP?
body: <p>I'm coding in PHP. I have the following mySQL table:</p>
  
  <pre><code>CREATE TABLE `students` (
    `ID` int(10) NOT NULL AUTO_INCREMENT,
    `Name` varchar(255) DEFAULT NULL,
    `Start` int(10) DEFAULT NULL,
    `End` int(10) DEFAULT NULL,
     PRIMARY KEY (`ID`)
   ) ENGINE=InnoDB;
  </code></pre>
  
  <p>I'm trying to use the <a href="http://php.net/manual/en/mysqli.query.php" rel="noreferrer">mysqli_query</a> function in PHP to DESCRIBE the table.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>$link = mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DATABASE);
  $result = mysqli_query($link,"DESCRIBE students");
  </code></pre>
  
  <p>The documentation says <em>For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a <a href="http://php.net/manual/en/class.mysqli-result.php" rel="noreferrer">mysqli_result</a> object.</em></p>
  
  <p>But from there I don't know how to print <code>$result</code> so that it shows the query results. If possible I want to print $result so that it looks like:</p>
  
  <pre><code>+----------+--------------+------+-----+---------+----------------+
  | Field    | Type         | Null | Key | Default | Extra          |
  +----------+--------------+------+-----+---------+----------------+
  | ID       | int(10)      | NO   | PRI | NULL    | auto_increment |
  | Name     | varchar(255) | YES  |     | NULL    |                |
  | Start    | int(10)      | YES  |     | NULL    |                |
  | End      | int(10)      | YES  |     | NULL    |                |
  +----------+--------------+------+-----+---------+----------------+ 
  </code></pre>
  
  <p>My other question is how to print the query <code>SHOW CREATE TABLE students</code>. </p>
  
  <pre><code>$result = mysqli_query($link,"SHOW CREATE TABLE students");
  </code></pre>