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 8694181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:43:32+00:00 2026-06-13T00:43:32+00:00

I’ve seen that this unknown column in ‘field list’ is a frequently occurring problem

  • 0

I’ve seen that this unknown column in 'field list' is a frequently occurring problem and often has a simple solution. In my case the only thing I can think of is that some of my variables need quotes, but considering I’m pulling data from an array my initial reaction is that that is wrong.
I’m experimenting with creating tables in Perl, hence results.

I can create a table ($table is declared previously) fine using:

$dbh->do("create table if not exists $table ( id int(5) not null auto_increment, 
                                              time int(2) default null, 
                                              result_1 varchar(30), 
                                              result_2 varchar(30), 
                                              result_3 varchar(30), 
                                              rating int(2) default null, 
                                              primary key (id))");

But when it comes to inserting my ‘results’:

my @results = ('abc','def','ghi');
my $r_1 = $results[0];
my $r_2 = $results[1];
my $r_3 = $results[2]; # (these results print out fine)
my $time = time;
my $insert = $dbh->prepare("insert into $table values(id,$time,$r_1,$r_2,$r_3,'')");
$insert->execute;

I get the error:

DBD::mysql::st execute failed: Unknown column 'abc' in 'field list' at ...

Should I need to add extra quotations when inserting the results from an array? Or is there another problem (probably simple!) that I haven’t seen?

  • 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-13T00:43:33+00:00Added an answer on June 13, 2026 at 12:43 am

    Your problem is with quoting, as you suspected. However, you shouldn’t manually insert quotes into the string. Instead, this is the correct way:

    my @results = ('abc','def','ghi');
    my $r_1 = $results[0];
    my $r_2 = $results[1];
    my $r_3 = $results[2]; # (these results print out fine)
    my $time = time;
    my $insert = $dbh->prepare("insert into $table values(id,?,?,?,?,'')");
    
    $insert->execute($time,@results);
    

    The advantages of this are:

    • You don’t have to handle quoting, or even know whether a variable needs to be quoted.
    • Things that are undefined in Perl automatically become null in the database.
    • It is more efficient, as you can execute many times using different values. You only have to prepare once.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am doing a simple coin flipping experiment for class that involves flipping a
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.