Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9298241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:16:26+00:00 2026-06-18T22:16:26+00:00

I have a database table – serial (autoincrement primary key), version, and turk_number. I

  • 0

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.

$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->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

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

}
catch(PDOException $e)
{
    echo $e->getMessage();
}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:16:28+00:00Added an answer on June 18, 2026 at 10:16 pm

    You forgot the quotes.

    Change:

    $query2 = "INSERT INTO participants (version, turk_number) VALUES (:version, :turk_number)";
    

    to:

    $query2 = "INSERT INTO participants (version, turk_number) VALUES (':version', ':turk_number')";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table and one of the fields (not the primary key)
I have a database table containing the following columns: id code value datetime timestamp
I have a database table with some rows that I want to fetch using
I have a database table using an enum. This is already working with hibernate
I have a database table where I track people using my app. There might
I have a database table where users can filter a single column using a
I have Database table and I am using SQL Server 2008. The table contins
I have a database table that holds the following grade information for a student:
I have database table represented as text file in the following pattern: 0|ALGERIA|0| haggle.
I have a database table that I am using as a source for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.