title: I want to fetch last inserted data from database
body: <p>I created table like this</p>
  
  <pre><code>id
  a1
  a2
  a3
  a
  a4
  a5
  a6
  
  1
  3
  1
  7
  63
  3
  5
  0
  
  
  2
  3
  1
  7
  35
  3
  5
  0
  
  3
  3
  1
  7
  40
  3
  5
  0
  
  
  5
  1
  5
  5
  44
  2
  2
  2
  
  6
  5
  6
  9
  07
  5
  5
  7
  
  7
  5
  6
  9
  07
  5
  5
  7
  </code></pre>
  
  <p>Now I want to fetch latest data from this table to homepage of my website.</p>
  
  <p>Latest row would be max id.</p>
  
  <p><strong><em>On home page it should show like this:</em></strong></p>
  
  <blockquote>
    <p>a1a2a3 - a - a4a5a6</p>
  </blockquote>
  
  <p>Means</p>
  
  <p>On home page it should show {- is separator}
  like this:</p>
  
  <p>I used following code but it prints only a value which is INR of 2</p>
  
  <pre><code>&lt;?php
  
  mysql_connect("localhost","username","password");
  mysql_select_db(dbname);
  
  $q = "SELECT a FROM table
  ORDER BY id DESC
  LIMIT 1;";
  $result = mysql_query($q);
  $data = mysql_fetch_array($result);
  
  echo $data[0];
  
  ?&gt;
  </code></pre>