title: Fetch row of data from database based on url variable (ex. template.php?id=1)
body: <p>I'm trying to create a template that fetches a row of data from a database based on the url variable ?id=1 for example. when <a href="http://www.example.com/template.php?id=1" rel="nofollow">http://www.example.com/template.php?id=1</a> is visited, I'd like to display all of the information from that specific row, E.G the title.</p>
  
  <p>At the moment I have this through looking at php.net and messing around with it somewhat. I've got little idea on how to fix this as I'm new to PHP and don't have that much experience :S.</p>
  
  <pre><code>$result = mysql_query("SELECT id,title FROM table WHERE id = urldecode( $_GET['id']        ) ");
  if (!$result) {
  echo 'Could not run query: ' . mysql_error();
  exit;
  }
  $row = mysql_fetch_row($result);
  
  echo $row[0];
  echo $row[1];
  </code></pre>
  
  <p>Hope this isn't too broad.</p>