php - not loading variable into the database
<p>I have a database table - serial (autoincrement primary key), version, and turk_number. I am using the following code to insert a new row. I am receiving these variables via $_GET and I did a printout so I know that the variables are available, so I'm not sure whats wrong. The serial and version are loaded in, but not the turk_number.</p>

<pre><code>$turk_number ='';
$serial='';
$version='';
if(isset($_GET['serial']))
{
    $serial=$_GET['serial'];
    $_SESSION['serial'] = $serial;
}
if(isset($_GET['version']))
{
    $version = $_GET['version'];
    $_SESSION['version'] = $version;
    print "version=" . $version;
}
if(isset($_GET['turk_number']))
{
    $turk_number= $_GET['turk_number'];
    $_SESSION['turk_number'] = $turk_number;
    print "turk number=".$turk_number;
}

//this assigns a participant a unique serial id at the beginning of the game
$hostname = "localhost";
$username = "root";
$password = "";
$dbname = "resolver";

try 
{
print 'turk2=' . $turk_number;
    $dbh = new PDO("mysql:host=$hostname;dbname=$dbname", $username, $password);

    $dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $query2 = "INSERT INTO participants (version, turk_number) VALUES (:version, :turk_number)";
        $stmt = $dbh -&gt;prepare($query2);
        $stmt -&gt;execute(array(':version' =&gt; $version,
                            ':turk_number' =&gt; $turk_number));

}
catch(PDOException $e)
{
    echo $e-&gt;getMessage();
}   
</code></pre>
