title: MYSQL Select to file
body: <p>I'd like to save the output from a "Select * FROM table1" in console to a file in PHP.</p>
  
  <p>What would be the most efficient way to do this in php?</p>
  
  <p>Edit:
  I'd like the output to be like the type in the console ie.</p>
  
  <pre><code>+--------+--------+
  | thing1 | thing2 |
  +--------+--------+
  | item1a | item2a |
  | item1b | item2b |
  +--------+--------+
  </code></pre>
  
  <p>Also, I was thinking that the php code should be "exec(mysql command which I'm looking for)". It's my understanding that mysql_fetch_array is slow, and I'm looking for a simple output...so it should be possible to somehow do this from the console. (Thanks for the responses thus far!)</p>