title: What is the best way to display a SQL table through PHP?
body: <p>I've looked on Google, but I haven't been able to find the best, simplest way to display SQL tables through PHP.  I'm new at PHP and SQL, so I'm a bit confused.  I have this so far, but I'm not even sure how the rows work.  I just want to display the whole table.  </p>
  
  <pre><code>&lt;?php
  $dbname = 'my_db';
  
  if (!mysql_connect('localhost', 'username', 'password')) {
      echo 'Could not connect to mysql';
      exit;
  }
  
  $sql = "SHOW TABLES FROM $dbname";
  $result = mysql_query($sql);
  
  if (!$result) {
      echo "DB Error, could not list tables\n";
      echo 'MySQL Error: ' . mysql_error();
      exit;
  }
  
  while ($row = mysql_fetch_row($result)) {
      echo "Table: {*}\n";
  }
  
  mysql_free_result($result);
  ?&gt;
  </code></pre>