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