title: Getting a Mysql Results without knowing a column name
body: <p>As I am still learning PHP and MySQL, I would like to know if it is possible to query a table without knowing it's name. Knowing the table I am querying and the column I would like to retrieve, I can write something like </p>
  
  <pre><code>$book_title=$row['book_title'];
  </code></pre>
  
  <p>Then I can use the resulting variable later in the script. In each case, each book category table will have a column of interest with a different name. I have several tables on which I am running queries. I am able to query any table by using a variable that always evaluates to the correct table name, because all the input from users corresponds to the tables in the database, so the $_POST super global will always carry a correct table name. The problem is for me to have a </p>
  
  <pre><code>$variable=$row['column'];
  </code></pre>
  
  <p>in cases where I do not know a column name before hand even though I know the table name.  </p>
  
  <p>My queries are simple, and look like </p>
  
  <pre><code>query="select * FROM $book_categories WHERE id=$id";
  $row = mysqli_fetch_array ($result);
  $variable=$row['?'];
  </code></pre>
  
  <p>The question mark say, I do not know what column to expect, as it's name could be anything from the tables in the database!</p>
  
  <p>Since I have several tables, the query  will zero on a table, but the column names in each table varies so I would like to be able to use one query that can give me an entry from such a column.</p>
  
  <p>I hope my question is clear and that I am not asking for the impossible. If it's ambiguous, I care to elucidate (hope so).</p>