Here is my code. I'm using MS-Access 97' unfortunately.
#Compile all records under a clients aliases foreach $alias (@aliases) { $query = "SELECT collection_information.[field1], "; $query .= "collection_information.[field2], collection_informat +ion.[name] "; $query .= "FROM collection_information WHERE CLIENT=\'" . $alia +s ."\'"; $sth = $dbh->prepare($query); $sth->execute(); #For each record returned while(my @record = $sth->fetchrow_array) { #Insert the record into the database $query = "INSERT INTO " . $client{'name'} ."_table "; $query .= "([field1],[field2],[name]) VALUES "; $query .= "(\'".$record[0]."\',\'".$record[1]."\',\'".$record[ +2]."\')"; $dbh->do($query); } $sth->finish(); }
Ok here's my problem... the insert statement is inserting people's names in one field. Now if someone's name such as O'Sullivan occurs... then this piece of code will foobar because of the single quoting in the VALUES portion of the insert statement. However, when I try and double quote it... it tells me it expects 3 parameters.

In my early DBI experience I had this problem occur and corrected it by changing the query to double quote the values... that was under MySQL (God I miss those days). Any possible remedies to this?
Thanks in advance, Gry

In reply to Quoting problem in DBI:ODBC by Grygonos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.