title: Get url parameter and insert into database
body: <p>Trying to insert into database by typing the value in the url, but having difficulties to insert into the database:</p>
  
  <p>Here is the URL:</p>
  
  <pre><code>http://student.cs.hioa.no/~s180343/updatedb.php?verdi=22
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  
  $dbhost = "MYSQL-SERVER";
  $dbuser = "USERNAME";
  $dbpass = "";
  $verdi = $_GET['verdi'];
  
  $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  if(! $conn )
  {
    die('Could not connect: ' . mysql_error());
  }
  $sql = "INSERT INTO test ('id') VALUES (`$verdi`)";
  
  mysql_select_db('s180350');
  $retval = mysql_query( $sql, $conn );
  if(! $retval )
  {
    die('Could not enter data: ' . mysql_error());
  }
  echo "Entered data successfully\n";
  mysql_close($conn);
  ?&gt;
  </code></pre>